How to use the runtime function from nunjucks

Find comprehensive JavaScript nunjucks.runtime code examples handpicked from public code repositorys.

121
122
123
124
125
126
127
128
129
130
}

let source = src

if (!source || source.trim().length === 0) {
  source = new nunjucks.runtime.SafeString((
    vars.isMarkdown ? `![](${result})` : `
      <img ${options.class ? `class="${options.class}"` : ''} src="${result}"
        width="${chartOptions.width}"
        height="${chartOptions.height}"
fork icon1
star icon4
watch icon0

+ 5 other calls in file

108
109
110
111
112
113
114
115
116
117
let [context, ...argArray] = args;

if (isAsync) {
  shortcodeFn(...argArray)
    .then(function(returnValue) {
      callback(null, new NunjucksLib.runtime.SafeString(returnValue));
    })
    .catch(function(e) {
      callback(
        new EleventyShortcodeError(
fork icon0
star icon0
watch icon0

+ 11 other calls in file

27
28
29
30
31
32
33
34
35
36
  parser.advanceAfterBlockEnd();
  return new nodes.CallExtension(this, 'run', args, [body]);
};

this.run = function(context, body) {
  return new nunjucks.runtime.SafeString(`<style>
    ${postcss([require('postcss-preset-env'), require('autoprefixer')])
      .process(body(), { from: undefined, to: undefined }).css}
  </style>`);
};
fork icon0
star icon0
watch icon0

+ 5 other calls in file

62
63
64
65
66
67
68
69
70
        }
      });
      body = body.join("\n"); // Rejoin into one string.
    }


    return new nunjucks.runtime.SafeString(md.render(body));
  }
}
fork icon0
star icon0
watch icon0

+ 3 other calls in file

462
463
464
465
466
467
468
469
470
471
472
                    s.parentNode.insertBefore(hm, s);
                })();
            </script>
            `;
        }
        return new nunjucks.runtime.SafeString(metaStr);
    };
}


// 静态资源
fork icon0
star icon0
watch icon0

+ 2 other calls in file