Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@rhinostone/swig-jinja2

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rhinostone/swig-jinja2

Jinja2-syntax frontend for the @rhinostone/swig-core template engine. Part of the @rhinostone/swig multi-flavor family.

latest
Source
npmnpm
Version
2.7.3
Version published
Weekly downloads
594
8.2%
Maintainers
1
Weekly downloads
 
Created
Source

@rhinostone/swig-jinja2

NPM version Socket Badge

Jinja2-syntax frontend for the @rhinostone/swig-core template engine. Part of the multi-flavor architecture introduced in 2.0.0 — see ROADMAP.md for the release narrative.

Installation

npm install @rhinostone/swig-jinja2

This pulls in @rhinostone/swig-core as a peer dependency, pinned to the matching version. Frontends and the core release in lockstep — do not mix versions.

Basic example

var swig = require('@rhinostone/swig-jinja2');

var out = swig.render('Hello, {{ name|upper }}!', {
  locals: { name: 'world' }
});
// => Hello, WORLD!

Supported surface (as of 2.5.0)

A near-subset of Python Jinja2 — everything below was cross-checked against Jinja2 3.x.

  • Tagsset, if / elif / else, for (with else), block, extends, include, macro, import, from, raw, filter, with, autoescape.
  • Operators** power, // floor-division, ~ string concat, inline-if (a if c else b), Python slicing (seq[start:stop:step]), is <test> / is not <test>, plus {{- … -}} / {%- … -%} whitespace control.
  • Built-in is testsdefined, undefined, none, even, odd, divisibleby, iterable, mapping, sequence, string, number, boolean, callable, lower, upper, sameas.
  • Filters — 39 built-ins (upper, lower, capitalize, title, trim, truncate, replace, striptags, format, wordcount, wordwrap, indent, center, urlencode, escape / e, safe, first, last, join, reverse, sort, length / count, list, unique, batch, slice, dictsort, groupby, min, max, sum, random, abs, round, int, float, default / d, tojson, date). See lib/filters.js for the full list.
  • AsyncrenderFileAsync / compileFileAsync for async loaders.

Explicitly unsupported (parse-time throw or absent)

  • No sandboxed-rendering mode — template source is trusted.
  • {% call %}, {% do %}, {% trans %} — deferred / Jinja2 extensions.
  • map / select / reject / selectattr / rejectattr filters — deferred.
  • Macro kwargs — use positional args or an object literal.
  • Dynamic {% extends %} / {% import %} / {% from %} — string-literal paths only.
  • Bracket-notation {% set foo["x"] = … %} — use dot-path notation.

Repository

Source: gina-io/swig/packages/swig-jinja2. File issues and PRs at gina-io/swig.

License

MIT. See LICENSE in the monorepo root.

Keywords

template

FAQs

Package last updated on 10 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts