Registers an async global callable (...args) => any.
Custom tag extension (Nunjucks addExtension): tags, optional blocks map (opening tag → end tag name), and process(context, args, body) — body is null for simple tags.
Registers (input, ...args) => any. Overrides a built-in filter with the same name.
Registers a global: JSON-serializable value, or a JavaScript function invoked for {{ name(...) }} (Nunjucks-style keyword args as a trailing object). See NUNJUCKS_PARITY.md (P1).
Registers (value, ...args) => boolean (truthy return) for is tests and for select / reject. Built-in tests (odd, even, …) take precedence over the same name.
Subset of Nunjucks configure: autoescape (truthy/falsy coercion like Nunjucks), dev, throwOnUndefined, trimBlocks, lstripBlocks, and tags are applied.
Returns an introspection-only descriptor for a registered extension (tags + block end tags).
Loads a named template from this environment’s loader (same idea as Nunjucks getTemplate).
OptionaleagerCompile: boolean | nullReturns whether a custom extension with this name is registered (Nunjucks hasExtension).
Clears parse caches for named templates and inline renderString / Template sources (Nunjucks invalidateCache).
Unregisters a custom extension by name (Nunjucks removeExtension). Returns true if it existed.
Renders with this environment. Env is required so custom filters can call back into JavaScript synchronously.
Async render of an inline template string. Returns a Promise<string>.
Async render of an inline template string. Returns a Promise<string>.
Supports async-only tags (asyncEach, asyncAll, ifAsync) and async filters/globals.
Implementation note: Rendering executes synchronously on the calling thread
(the Node.js main thread) via a current-thread tokio runtime. The result is wrapped
in an already-resolved/rejected Promise. This matches the Nunjucks renderString
callback API surface but does not yield the event loop during render. This is
an intentional trade-off: the async renderer's future holds &mut borrows that are
!Send, preventing off-thread execution. True non-blocking rendering would require
an Arc<Mutex<...>>-based state design in a future major version.
Same as [render_string], but context is a JSON string (see [render_string_from_json]).
Renders a named template from the map set via [set_template_map].
Async render of a named template. Returns a Promise<string>.
Same blocking-then-Promise-wrap behavior as [render_string_async].
Sync callback (name: string) => string | null | { src: string }. null / undefined JSON as
null means template not found. Replaces any previous loader (same as setTemplateMap /
setLoaderRoot). Does not use the named parse cache per key (sources may change arbitrarily).
Loads named templates from a directory on disk (relative paths under root). Replaces any
previous loader. See [runjucks_core::FileSystemLoader].
Fixes the PRNG used by | random for reproducible tests (omit / pass undefined to use a fresh non-deterministic seed per render).
Optionalseed: number | nullSets an in-memory template map (name → source). Enables renderTemplate, {% include %}, {% extends %}, etc.
Registers an async filter
(input, ...args) => any. The function is called synchronously on the main thread during render, but registered as an async filter so it's available inrenderStringAsync/renderTemplateAsync.