minijinja-contrib
Extra utilities for MiniJinja
2.24.0
7.0M downloads/mo
#3796 most downloaded on crates.io
mitsuhiko/minijinja
What this package is like to depend on
Last release 11 days ago
12 Aug 2026
Release timing varies
gaps range from 8 days to 3 months
Nearly every release is documented
notes for 60 of 60 stable releases
Nothing withdrawn
no release was ever pulled
3 years old
66 releases · first in 2023
15 releases in the last 12 months
see the full history below
Release timeline
66 releases · Apr 2023 to Aug 2026Releases
latest 60 of 66-
3.0.0-alpha.012 Aug 2026 pre-releaseRelease notes
Open source →- Started the MiniJinja 3.0 alpha series. This release contains breaking API changes and is intended for testing.
- Made mutable
Statethe canonical path for functions, filters, tests, objects, methods, formatters, and nested macro calls. Read-only typed callbacks can continue to use&State; state mutation and dynamic calls now require&mut State. Added typed render-local extensions that persist through includes, blocks, and macros. - Removed
State::get_or_set_temp_object; use typed render-local extensions instead of object wrappers and interior mutability. - Removed Rust APIs deprecated before 3.0:
Template::render_and_return_state,Template::render_to_write,Template::eval_to_state, theFilter,Test,TestResult, andViaDeserializealiases,value::intern, and the no-opkey_interningfeature. The no-oploaderfeature was also removed; loader APIs remain available unconditionally. - Made
serdeoptional, explicit, and disabled by default. Rendering APIs now acceptInto<Value>; enable the feature and use thevalue::Serdewrapper for Serde conversion. Disabling the feature fully removes the dependency and no longer substitutes a fallback serialization trait. #528 - Added first-class tuple literals and public tuple value types in Rust and Go. Tuples now preserve their type through serialization and sequence operations, render like Python tuples, and roundtrip as tuples through the Python binding. JavaScript receives evaluated tuples as arrays. #785
- Changed sequence and map representations in Rust and Go to use Python-style string quoting, and changed
tojsonto use Jinja2-compatible separator spacing. #785 - Changed the MiniJinja-Go module path from
/v2to/v3. - Fixed the JavaScript binding's
semi_strictundefined behavior spelling. - Changed
context!andargs!to consume values and convert exclusively throughInto<Value>; wrap Serde values invalue::Serde. - Added native Rust tuple conversions and
Value::from_pairs. Collecting pairs directly intoValuenow creates a sequence of tuples rather than a map. - Replaced
ViaDeserializewith the unifiedvalue::Serdeadapter for both explicit serialization and function argument deserialization. - Changed
Valuefunction arguments to reject implicit keyword-argument values. Variadic functions that intentionally capture them can useValueOrKwargs. #596
-
2.24.012 Aug 2026Release notes
Open source →Release Notes
- Added the
wordwrapfilter to the Python bindings. #885 - Fixed conditional expressions in keyword argument values for Jinja2 compatibility in Rust and Go. #921
- Fixed
context!sorting keys when thepreserve_orderfeature is enabled. #920 - Limited string repetition to 100 MB in Rust and Go to prevent excessive memory allocations.
Install minijinja-cli 2.24.0
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mitsuhiko/minijinja/releases/download/2.24.0/minijinja-cli-installer.sh | sh
Install prebuilt binaries via powershell script
powershell -ExecutionPolicy Bypass -c "irm https://github.com/mitsuhiko/minijinja/releases/download/2.24.0/minijinja-cli-installer.ps1 | iex"Download minijinja-cli 2.24.0
File Platform Checksum minijinja-cli-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum minijinja-cli-x86_64-apple-darwin.tar.xz Intel macOS checksum minijinja-cli-aarch64-pc-windows-msvc.zip ARM64 Windows checksum minijinja-cli-i686-pc-windows-msvc.zip x86 Windows checksum minijinja-cli-x86_64-pc-windows-msvc.zip x64 Windows checksum minijinja-cli-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum minijinja-cli-i686-unknown-linux-gnu.tar.xz x86 Linux checksum minijinja-cli-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum minijinja-cli-armv7-unknown-linux-gnueabihf.tar.xz ARMv7 Linux checksum minijinja-cli-aarch64-unknown-linux-musl.tar.xz ARM64 MUSL Linux checksum minijinja-cli-i686-unknown-linux-musl.tar.xz x86 MUSL Linux checksum minijinja-cli-x86_64-unknown-linux-musl.tar.xz x64 MUSL Linux checksum Release notes
Open source →- Added the
wordwrapfilter to the Python bindings. #885 - Fixed conditional expressions in keyword argument values for Jinja2 compatibility in Rust and Go. #921
- Fixed
context!sorting keys when thepreserve_orderfeature is enabled. #920 - Limited string repetition to 100 MB in Rust and Go to prevent excessive memory allocations.
- Added the
-
2.23.006 Aug 2026Release notes
Open source →Release Notes
- Fixed Unicode identifiers in templates rendered through the Python bindings.
Install minijinja-cli 2.23.0
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mitsuhiko/minijinja/releases/download/2.23.0/minijinja-cli-installer.sh | sh
Install prebuilt binaries via powershell script
powershell -ExecutionPolicy Bypass -c "irm https://github.com/mitsuhiko/minijinja/releases/download/2.23.0/minijinja-cli-installer.ps1 | iex"Download minijinja-cli 2.23.0
File Platform Checksum minijinja-cli-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum minijinja-cli-x86_64-apple-darwin.tar.xz Intel macOS checksum minijinja-cli-aarch64-pc-windows-msvc.zip ARM64 Windows checksum minijinja-cli-i686-pc-windows-msvc.zip x86 Windows checksum minijinja-cli-x86_64-pc-windows-msvc.zip x64 Windows checksum minijinja-cli-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum minijinja-cli-i686-unknown-linux-gnu.tar.xz x86 Linux checksum minijinja-cli-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum minijinja-cli-armv7-unknown-linux-gnueabihf.tar.xz ARMv7 Linux checksum minijinja-cli-aarch64-unknown-linux-musl.tar.xz ARM64 MUSL Linux checksum minijinja-cli-i686-unknown-linux-musl.tar.xz x86 MUSL Linux checksum minijinja-cli-x86_64-unknown-linux-musl.tar.xz x64 MUSL Linux checksum Release notes
Open source →- Fixed Unicode identifiers in templates rendered through the Python bindings.
-
2.22.004 Aug 2026Release notes
Open source →Release Notes
- Changed rendering of none and boolean values to
None,True, andFalsefor Jinja2 compatibility in Rust and Go. #913 - Added
StringInputfor custom Rust filters and functions that transform strings while preserving safety provenance. - Fixed safety handling in string-transforming and composing filters to preserve safe strings and escape unsafe fragments in Rust and Go.
- Fixed the
splitfilter to return a sequence, enabling negative indexing and slicing in Rust and Go. #909 - Fixed Python-compatible dict methods being shadowed by same-named map keys. #903
- Fixed loop-local assignments leaking into subsequent iterations in Rust and Go. #912
Install minijinja-cli 2.22.0
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mitsuhiko/minijinja/releases/download/2.22.0/minijinja-cli-installer.sh | sh
Install prebuilt binaries via powershell script
powershell -ExecutionPolicy Bypass -c "irm https://github.com/mitsuhiko/minijinja/releases/download/2.22.0/minijinja-cli-installer.ps1 | iex"Download minijinja-cli 2.22.0
File Platform Checksum minijinja-cli-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum minijinja-cli-x86_64-apple-darwin.tar.xz Intel macOS checksum minijinja-cli-aarch64-pc-windows-msvc.zip ARM64 Windows checksum minijinja-cli-i686-pc-windows-msvc.zip x86 Windows checksum minijinja-cli-x86_64-pc-windows-msvc.zip x64 Windows checksum minijinja-cli-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum minijinja-cli-i686-unknown-linux-gnu.tar.xz x86 Linux checksum minijinja-cli-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum minijinja-cli-armv7-unknown-linux-gnueabihf.tar.xz ARMv7 Linux checksum minijinja-cli-aarch64-unknown-linux-musl.tar.xz ARM64 MUSL Linux checksum minijinja-cli-i686-unknown-linux-musl.tar.xz x86 MUSL Linux checksum minijinja-cli-x86_64-unknown-linux-musl.tar.xz x64 MUSL Linux checksum Release notes
Open source →- Changed rendering of none and boolean values to
None,True, andFalsefor Jinja2 compatibility in Rust and Go. #913 - Added
StringInputfor custom Rust filters and functions that transform strings while preserving safety provenance. - Fixed safety handling in string-transforming and composing filters to preserve safe strings and escape unsafe fragments in Rust and Go.
- Fixed the
splitfilter to return a sequence, enabling negative indexing and slicing in Rust and Go. #909 - Fixed Python-compatible dict methods being shadowed by same-named map keys. #903
- Fixed loop-local assignments leaking into subsequent iterations in Rust and Go. #912
- Changed rendering of none and boolean values to
-
2.21.017 Jun 2026Release notes
Open source →Release Notes
- Fixed a panic when comparing two numbers that have no common lossless representation, such as a float against an integer that cannot be represented exactly as
f64(for example1.0 < 9007199254740993). #904 - Fixed a stack overflow caused by repeated sequence concatenation. #907
- Improved performance of iteration over map items. #906
Install minijinja-cli 2.21.0
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mitsuhiko/minijinja/releases/download/2.21.0/minijinja-cli-installer.sh | sh
Install prebuilt binaries via powershell script
powershell -ExecutionPolicy Bypass -c "irm https://github.com/mitsuhiko/minijinja/releases/download/2.21.0/minijinja-cli-installer.ps1 | iex"Download minijinja-cli 2.21.0
File Platform Checksum minijinja-cli-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum minijinja-cli-x86_64-apple-darwin.tar.xz Intel macOS checksum minijinja-cli-aarch64-pc-windows-msvc.zip ARM64 Windows checksum minijinja-cli-i686-pc-windows-msvc.zip x86 Windows checksum minijinja-cli-x86_64-pc-windows-msvc.zip x64 Windows checksum minijinja-cli-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum minijinja-cli-i686-unknown-linux-gnu.tar.xz x86 Linux checksum minijinja-cli-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum minijinja-cli-armv7-unknown-linux-gnueabihf.tar.xz ARMv7 Linux checksum minijinja-cli-aarch64-unknown-linux-musl.tar.xz ARM64 MUSL Linux checksum minijinja-cli-i686-unknown-linux-musl.tar.xz x86 MUSL Linux checksum minijinja-cli-x86_64-unknown-linux-musl.tar.xz x64 MUSL Linux checksum Release notes
Open source →- Fixed a panic when comparing two numbers that have no common lossless representation, such as a float against an integer that cannot be represented exactly as
f64(for example1.0 < 9007199254740993). #904 - Fixed a stack overflow caused by repeated sequence concatenation. #907
- Improved performance of iteration over map items. #906
- Fixed a panic when comparing two numbers that have no common lossless representation, such as a float against an integer that cannot be represented exactly as
-
2.20.019 May 2026Release notes
Open source →Release Notes
- Added support for Jinja-style
requiredblocks in Rust and Go, includingscoped requiredparsing compatibility and validation that required blocks only contain whitespace or comments. - Added support for chained comparisons (for example
a < b < c) in Rust and Go to match Jinja/Python semantics. - Fixed dotted integer lookup in the middle of attribute chains (for example
foo.0.bar) for Jinja compatibility. #900 - Fixed compilation with
multi_templatedisabled by gating block-only APIs behind the feature.
Install minijinja-cli 2.20.0
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mitsuhiko/minijinja/releases/download/2.20.0/minijinja-cli-installer.sh | sh
Install prebuilt binaries via powershell script
powershell -ExecutionPolicy Bypass -c "irm https://github.com/mitsuhiko/minijinja/releases/download/2.20.0/minijinja-cli-installer.ps1 | iex"Download minijinja-cli 2.20.0
File Platform Checksum minijinja-cli-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum minijinja-cli-x86_64-apple-darwin.tar.xz Intel macOS checksum minijinja-cli-aarch64-pc-windows-msvc.zip ARM64 Windows checksum minijinja-cli-i686-pc-windows-msvc.zip x86 Windows checksum minijinja-cli-x86_64-pc-windows-msvc.zip x64 Windows checksum minijinja-cli-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum minijinja-cli-i686-unknown-linux-gnu.tar.xz x86 Linux checksum minijinja-cli-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum minijinja-cli-armv7-unknown-linux-gnueabihf.tar.xz ARMv7 Linux checksum minijinja-cli-aarch64-unknown-linux-musl.tar.xz ARM64 MUSL Linux checksum minijinja-cli-i686-unknown-linux-musl.tar.xz x86 MUSL Linux checksum minijinja-cli-x86_64-unknown-linux-musl.tar.xz x64 MUSL Linux checksum Release notes
Open source →- Added support for Jinja-style
requiredblocks in Rust and Go, includingscoped requiredparsing compatibility and validation that required blocks only contain whitespace or comments. - Added support for chained comparisons (for example
a < b < c) in Rust and Go to match Jinja/Python semantics. - Fixed dotted integer lookup in the middle of attribute chains (for example
foo.0.bar) for Jinja compatibility. #900 - Fixed compilation with
multi_templatedisabled by gating block-only APIs behind the feature.
- Added support for Jinja-style
-
2.19.001 Apr 2026Release notes
Open source →- Fixed strict undefined behavior for comparison operators (such as
==), string concatenation (~), and undefined needles in theinoperator to better match Jinja2. #886 #888 - Fixed the
defaultfilter in strict undefined mode so an explicitly passed undefined fallback argument errors instead of being treated like a missing argument. #887
- Fixed strict undefined behavior for comparison operators (such as
-
2.18.015 Mar 2026Release notes
Open source →- Added keyword argument support (
width,first,blank) to theindentfilter for Jinja2 compatibility in Rust and Go. #864 - Added support for dotted integer lookup (for example
foo.0) in Rust and Go for Jinja compatibility. #881 - Added support for dotted filter and test names (including
foo . bar . baz) for Jinja compatibility. #879 - Fixed string escape handling to preserve unknown escapes (such as
\s) for Jinja compatibility in Rust and Go. #880 - Improved generic performance across template parsing, compilation, and rendering.
- Fixed
minijinja-cabiownership and pointer-safety issues that could leakmj_valuevalues on error paths. - Added high-priority
minijinja-cabiAPIs for callback-based functions/filters/tests, globals, loaders, path joining, auto-escape configuration, and fuel limits. - Switched
minijinja-cabiheader maintenance to manual source-based syncing and removed cbindgen-based generation tooling. - Added lightweight C smoke tests for
minijinja-cabi(viamake -C minijinja-cabi test) with coverage across all exported C ABI functions, and wired them into top-level testing and CI. - Added
render_capturedandrender_captured_tomethods onTemplatewhich return aCapturedtype holding the rendered output and the template state. - Added
into_outputmethod onCapturedto consume and return the output string. - Deprecated
render_and_return_state,eval_to_state, andrender_to_writein favor of the newrender_captured/render_captured_to/CapturedAPI.
- Added keyword argument support (
-
2.17.104 Mar 2026Release notes
Open source →- Re-release of 2.17.0 to fix release automation.
- Switched npm publishing to trusted publishing (OIDC/provenance) and removed token-based auth from CI.
- Prevented duplicate crates.io publish attempts by skipping slash-prefixed tags in crates publishing.
-
2.17.003 Mar 2026Release notes
Open source →- Added
'c'(character) format type support for format filters andstr.format-style formatting. #868 - Added prebuilt
minijinja-clirelease targets foraarch64-pc-windows-msvc(Windows ARM64) andarmv7-unknown-linux-gnueabihf. - Fixed strict and semi-strict undefined handling so string-coercing filter/function arguments also fail for nested
Rest<String>andVec<String>conversions. #877 - Fixed Python CI/build compatibility with newer
maturinby moving stripping from global config to release wheel build arguments.
- Added
-
2.16.020 Feb 2026Release notes
Open source →- Added musllinux wheel builds for Python release artifacts.
- Fixed
|escapeto honor custom formatters. #861 - Aligned undefined behavior handling in the Go port with Rust.
- Removed non-Rust
keysandvaluesfilters from the Go port for parity. #863
-
2.15.126 Jan 2026 -
2.15.026 Jan 2026Release notes
Open source →- Added
py.typedmarker for PEP 561 typing support in Python bindings. #853 - Added optional default argument to
map.get()method in pycompat. #852 - Added a go language port. #854
- Fixed stability guarantees for the
|sortfilter when usingreverse=true. #856 - Fixed missing
SemiStrictundefined mapping in Python bindings. #859
- Added
-
2.14.012 Dec 2025 -
2.13.030 Nov 2025Release notes
Open source →- Added multi-key support to the
|sortfilter. #827 - Added
formatfilter andstr.formatmethod for pycompat. #835 - Fix
not undefinedwith strict undefined behavior. #838 - Added support for free threading Python. #841
- Added
setLoaderandsetPathJoinCallbackto the JavaScript bindings. #842
- Added multi-key support to the
-
2.12.024 Aug 2025Release notes
Open source →- Item or attribute lookup will no longer swallow all errors in Python. #814
- Added
|zipfilter. #818 - Fix
break_on_hyphensfor the|wordwrapfilter. #823 - Prefer error message from
unknown_method_callback. #824 - Ignore
.jinjaand.jinja2as extensions in auto escape. #832
-
2.11.028 Jun 2025Release notes
Open source →- Fixed incorrect joining of leading undefineds or empty
strings in the
|joinfilter. This was inconsistent with Jinja2 and the filter itself for undefineds in other positions. #794 - Allow negative arguments to
rangefunction and change range toisize. #799 - Allow
isizeas argument type. #799 - MiniJinja now correctly handles
\xescape sequences in strings as well as octals. #805 - Added a new
|chainfilter. #807
- Fixed incorrect joining of leading undefineds or empty
strings in the
-
2.10.206 May 2025Release notes
Open source →- Fixed an issue with the function bounds that caused the next-generation trait resolver to fail. #787
-
2.10.105 May 2025 -
2.10.005 May 2025Release notes
Open source →- Fix incorrect permissions when
--outputis used in the CLI. #772 - Added
mj_err_get_debug_infoto the C-ABI. #775 - Modules now capture their output like they do in Jinja2. This
means that if you do
{% import 'template.j2' as x %}and you then render{{ x }}the output oftemplate.j2is rendered as if it was included. #778 - Improved compatibility with Jinja2 for slicing. Negative steps are now correctly handled. Additionally slicing on bytes now correctly handles steps other than 1. #781
- Fix incorrect permissions when
-
2.9.031 Mar 2025Release notes
Open source →- Do not panic if too large templates (too many lines or too many columns) are loaded. The error reporting will be wrong in those cases but the templates will load. #742
- Fixed a bug that caused unknown method callbacks to not get proper error reporting if they cannot find a method. #743
- Added
merge_mapswhich is a dynamic version of thecontext!merge feature, and fixed enumeration behavior when non-map objects are attempted to be merged. #745 - Added
mj_value_new_bytesto the C-ABI. #749 - Added
mj_value_as_bytesto the C-ABI to borrow from strings or byte values. #750 - Fixed buggy
mj_err_get_detailandmj_err_get_template_name. These did not work correctly. To fix them the return value now needs to be freed. #754 - Fix a compilation issue on 32bit systems when
AtomicU64is not available in minijinja-contrib. #755 - Correctly handle
with contextandwithout contextfor imports. #759 - The
defaultfilter is now also registered asdfor Jinja2 compatibility. #763 - The
defaultfilter now accepts a second argument to enable lax defaulting. #764 - Added a
striptagsfilter to the contrib module. #765 - Enable
pycompatby default for the Python bindings and register the default contrib filters and tests. #767
-
2.8.003 Mar 2025Release notes
Open source →- Added
SemiStrictundefined mode that is like strict but allows to be checked for truthiness. Additionally an if expression without an else block will always produce a silent undefined object that never errors for compatibility with Jinja2. #687 - Make the trait bounds of
ViaDeserializestricter. Now the type can only be constructed if the type implementsDeserializeOwned. This is not a new requirement for passing the function toadd_functionbut bad code will now error earlier for better error reporting. #689 - Raise MSRV to 1.70.
- The contrib crate now uses a basic xorrand implementation instead
of depending on all of the
randmodule. #696 - Added temps, a way to stash away temporary state during rendering. #697
- Fixed a bug that caused the random functions in the contrib crate to not advance the RNG between calls. #698
- Added
Environment.undeclared_variables_in_templateandEnvironnent.undeclared_variables_in_strto Python binding. #699 - Enable
loop_controlsfor Python in-line with the CLI. #704 - Fixed a panic when comparing plain objects. #705
- Added
Object::custom_cmpto allow objects to influence how they compare against themselves. This also fixes Python objects in the Python binding not to compare correctly. #707 - Fixed a bug where
undeclared_variableswould incorrectly handle variables referenced by macros. #714 - Fixed a deadlock in the Python binding when multiple threads were rendering from the same environment at once. #717
- The Python bindings handle
__bool__correctly now for custom objects in if-conditions and filters. #719 - Fixed a bug where
}}caused a syntax error in expressions with open parentheses, braces or brackets. #723 - Added
State::known_variablesto return a list of known variables andEnvironment::globals. #724 - Fixed an issue with undeclared variables not handling
caller. #725 - Removed unnecessary
FiltersandTeststraits. They remain as hidden aliases toFunction. #726 - Fixed a bug that caused implicit string concatenation to not correctly handle escapes. #728
- Implemented constant folding in the code generator. #731
- Improved error reporting for bad loop recursion calls. #734
- The engine now uses smaller integers to represent columns, line numbers and addresses. This cuts down on the memory usage needed for debug information. #735
- Added
load_from_pathto python. #736 - Added JavaScript bindings. #737
- Added
-
2.7.028 Jan 2025Release notes
Open source →- Removed string interning. #675
loop.nextitemis now a lazy operation. This prevents issues when iterating over one-shot iterators combined with{% break %}and it now ensures that the iterator is not running "one item ahead". #677- Fixed an issue that caused loop aliasing not to be supported for recursive loops. #678
- CLI moved from
serde_ymltoserde_yaml. #684 - Improved undefined error reporting. Undefined values will now in most cases point to exactly where the error happened. #686
- Allow newer notify dependency versions (up to 8.x) for the autoreload crate. #688
-
2.6.008 Jan 2025Release notes
Open source →- Added
sumfilter. #648 - Added
truncatefilter tominijinja-contrib. #647 - Added
wordcountfilter tominijinja-contrib. #649 - Added
wordwrapfilter tominijinja-contrib. #651 - Some tests and filters now pass borrowed values for performance reasons and a bug was fixed that caused undefined values in strict undefined mode not to work with tests. #657
- Fixed an error reporting issue for some syntax errors. #655
- Removed an
unsafecode block from theKwargstype internally which was probably unsafe. #659 - Fix a regression with latest serde that caused internals to leak out when flattening on value handles is used. #664
- Added
Value::make_object_mapto create projections from object into maps, similar to how it was already possible to create iterators that were projected from objects. #663 - The
|itemsfilter will no longer allocate a list and instead return an iterator. #665 - Fixed a bug that caused
lstrip_blocksto act too eager. #674
- Added
-
2.5.010 Nov 2024Release notes
Open source →minijinja-clinow supports preservation of order in maps. #611- Fixed an issue where CBOR was not correctly deserialized in
minijinja-cli. #611 - Added a
linesfilter to split a string into lines. - Bytes are now better supported in MiniJinja. They can be created from
Value::from_byteswithout having to go via serde, and they are now producing a nicer looking debug output. #616 - Added the missing
stringfilter from Jinja2. #617 - Reversing bytes and convergint them implicitly to strings will now work more consistently. #619
- Added type hints for the Python binding and relaxed maturin constraint. #590
minijinja-clinow allows the template name to be set to an empty string when--templateis used, to allow suppliying a data file. #624- Added the missing
sameasfilter from Jinja2. #625 - Tests can now support one argument without parentheses like in Jinja2
(
1 is sameas 1). #626 - Added error context for strict undefined errors during template rendering. #627
- Syntax errors caused by the lexer now include the correct position of the error. #630
minijinja-clinow has all features enabled by default as documented (that means also shell completion and ini). #633minijinja-clinow does not convert INI files to lowercase anymore. This was an unintended behavior. #633- Moved up MSRV to 1.63.0 due to indexmap. #635
- Added argument splatting support (
*argsfor variable args and**kwargsfor keyword arguments) and fixed a bug where sometimes maps and keyword arguments were created in inverse order. #642
-
2.3.117 Sep 2024Release notes
Open source →- Fixes a regression in
PartialEq/EqinValuecaused by changes in 2.3.0. #584
- Fixes a regression in
-
2.3.016 Sep 2024Release notes
Open source →- Fixes some compiler warnings in Rust 1.81. #575
- Fixes incorrect ordering of maps when the keys of those maps were not in consistent order. #569
- Implemented the missing
groupbyfilter. #570 - The
uniquefilter now is case insensitive by default like in Jinja2 and supports an optional flag to make it case sensitive. It also now lets one check individual attributes instead of values. #571 - Changed sort order of
Ordto avoid accidentally non total order that could cause panics on Rust 1.81. #579 - Added a
Value::is_integermethod to allow a user to tell floats and true integers apart. #580
-
2.2.026 Aug 2024Release notes
Open source →- Fixes a bug where some enums did not deserialize correctly when
used with
ViaDeserialize. #554 - Implemented
IntoDeserializerforValueand&Value. #555 - Added
filesizeformatto minijinja-contrib. #556 - Added support for the
loop_controlsfeature which adds{% break %}and{% continue %}. #558 - Iterables can now be indexed into. It was already possible previously to slice them. This improves support for Jinja2 compatibility as Jinja2 is more likely to create temporary lists when slicing lists. #565
- Fixes a bug where some enums did not deserialize correctly when
used with
-
2.1.209 Aug 2024Release notes
Open source →- Flush filter and test cache when processing extended template. This fixes a bug that caused the wrong filters to be used in some cases. #551
-
2.1.131 Jul 2024Release notes
Open source →- Added
indentparameter totojsonfilter. #546 - Added
randrange,lipsum,random,cyclerandjoinertominijinja-contrib. #547 - Added the ability to use
&TandArc<T>as parameters to filters and functions ifTis anObject. #548 minijinja-clinow also enables the datetime, timezone and rand features. #549- Aligned the behavior of the
intfilter closer to Jinja2. #549
- Added
-
2.1.022 Jul 2024Release notes
Open source →- minijinja-cli now supports
.inifiles. #532 - Fixed a bug that caused cycle detection to trigger incorrectly when an included template extended from another template. #538
- Bumped the minimum version of
self_cellto 1.0.4. #540 - MiniJinja will now warn if the
serdefeature is disabled. This is in anticipation of removing the serde dependency in the future. #541 - Improved an edge case with
State::resolve. It now can resolve the initial template context in macro calls even if no closure has been created. #542
- minijinja-cli now supports
-
2.0.302 Jul 2024Release notes
Open source →- Added new methods to pycompat:
str.endswith,str.rfind,str.isalnum,str.isalpha,str.isascii,str.isdigit,str.isnumeric,str.join,str.startswith. #522 - Added the missing tests
boolean,divisibleby,lowerandupper. #592 - minijinja-cli now supports YAML aliases and merge keys. #531
- Added new methods to pycompat:
-
2.0.211 Jun 2024Release notes
Open source →- Implemented sequence (+ some iterator) and string repeating with the
*operator to match Jinja2 behavior. #519 - Added the new
minijinja::pycompatmodule which allows one to register an unknown method callback that provides most built-in Python methods. This makes things such asdict.keyswork. Also adds a new--py-compatflag tominijinja-clithat enables it. This improves the compatibility with Python based templates. #521 - Added a new
|splitfilter that works like the.splitmethod in Python. #517
- Implemented sequence (+ some iterator) and string repeating with the
-
2.0.128 Apr 2024Release notes
Open source →- Fixed an issue that caused custom delimiters to not work in the Python binding. #506
-
2.0.028 Apr 2024Release notes
Open source →This is a major update to MiniJinja that changes a lot of core internals and cleans up some APIs. In particular it resolves some limitations in the engine in relation to working with dynamic objects, unlocks potentials for future performance improvements and enhancements.
It's very likely that you will need to do changes to your code when upgrading, particular when implementing dynamic objects. In short:
StructObjectandSeqObjectare gone. They have been replaced by improved APIs directly onObject. Please refer to the updated documentation to see how these objects behave now. For the most part code should become quite a bit clearer during the upgrade.ObjectKindhas been replaced byObjectRepr. Rather than holding a reference to aStructObjectorSeqObjectthis now is a simple enum that just indicates how that object serializes, renders and behaves.Objectno longer usesfmt::Displayfor rendering. Instead the newObject::rendermethod is used which has a default implementation.- The
Objecttrait has been completely transformed and the new type-erased typeDynObjecthas been added to work with unknown objects. This trait has an improved user experience and more flexibility. It's now possible to implement any non-primitive value type including maps with non string keys which was previously not possible. ValueKindis now non exhaustive and got a log of new value types. This resolves various issues in particular in relationship with iterators. As a result of this functions will no longer accidentally serialize into empty objects for example.Value::from_iteratorhas been replaced by the newValue::make_iterable,Value::make_object_iterableandValue::make_one_shot_iterator. The direct replacement isValue::make_one_shot_iteratorbut for most uses it's strongly recommended to use one of the other APIs instead. This results in a much improved user experience as it's possible to iterate over such values more than once.- The
Syntaxtype has been replaced by theSyntaxConfigtype. It uses a builder pattern to reconfigure the delimiters.
For upgrade instructions read the UPDATING guide.
Other Changes:
- Added a new
Environment::templatesmethod that iterates over loaded templates. #471 - Reverse iteration and slicing now return iterables instead of real sequences.
- The engine no longer reports iterable as sequences.
- The value iterator returned by
Value::try_iternow holds a reference to theValueinternally via reference counting. DynObjectnow replacesArc<Object>.- The debug printing of some objects was simplified.
- Added the
iterabletest. #475 - The parser no longer panics when using dotted assignments in unexpected places. #479
- The CLI now enables unicode support by default.
Value::from_serializableis nowValue::from_serialize.- Ranges are now iterables and no longer sequences and their maximum number of iterations was raised to 100000. #493
Value::fromis now implemented forErroras public API to create invalid values. Previously this behavior was hidden internally in the serde support. #495UndefinedBehavior::Strictnow acts more delayed. This means that nowvalue.key is definedwill no longer fail.- Added support for line statements and comments. #503
- The CLI now accepts
--syntaxto reconfigure syntax flags such as delimiters. #504
-
2.0.0-alpha.012 Apr 2024 pre-releaseNothing published for this version
-
1.0.2206 May 2025Release notes
Open source →- Fixed an issue with the function bounds that caused the next-generation trait resolver to fail. #790
-
1.0.2124 Apr 2024Release notes
Open source →- Fixed an issue where
lstrip_blocksunintentionally also applied to variable expression blocks. #502
- Fixed an issue where
-
1.0.2010 Apr 2024Release notes
Open source →- Added support for implicit string concatenation for Jinja2 compatibility. #489
- Added support for sequence concatenation with the plus operator for Jinja2 compatibility. #491
-
1.0.1809 Apr 2024 -
1.0.1708 Apr 2024Release notes
Open source →- Added support for
Option<Into<Value>>as return value from functions. #452 - Deprecated
Value::from_serializablefor the improved replacement methodValue::from_serialize. #482
- Added support for
-
1.0.1627 Mar 2024Release notes
Open source →- Tolerate underscores in number literals. #443
- Added support for
trim_blocksandlstrip_blocksfor Jinja2 compatibility. #447 - Changed API of
unstable_machinery. Thetokenizefunction got an extra argument for theWhitespaceConfig. It's however recommended to use the newTokenizerstruct instead.parse_exprwas added, theparsefunction now takes aSyntaxConfigandWhitespaceConfig. #447
-
1.0.1522 Mar 2024Release notes
Open source →- Resolved a compiler warning for Rust 1.77. #440
- Fixed an incorrect error case in
call_method. NowUnknownMethodis returned instead ofInvalidOperationcorrectly. #439 - Added
Environment::set_unknown_method_callbackwhich allows a user to intercept method calls on primitives. The motivation here is that this can be used to implement python like methods to improve the compatibility with Jinja2 Python templates. #441
-
1.0.1420 Mar 2024Release notes
Open source →- Fixed a bug with broken closure handling when working with nested
{% macro %}or{% call %}blocks. #435
- Fixed a bug with broken closure handling when working with nested
-
1.0.1317 Mar 2024Release notes
Open source →minijinja-clinow supports an-oor--outputparameter to write into a target file. #405minijinja-clinow accepts the--safe-pathparameter to disallow includes or extends from paths not explicitly allowlisted. #432- Added support for
Error::display_debug_infowhich displays just the debug info, same way as alternative display on the error does. #420 - Added the
namespace()function from Jinja2 and the ability to assign to it via{% set %}. #422 minijinja-autoreloadnow supportson_should_reload_callbackwhich lets one register a callback to be called just before an auto reload should be performed. #424- Added support for
Value::from_iterator,IteratorObjectandObjectKind::Iterator. #426 - Added support for
0b/0o/0xprefixed integer literals for binary, octal and hexadecimal notation. #433
-
1.0.1220 Jan 2024Release notes
Open source →- The
urlencodefilter now correctly skips over none and undefined. #394 - The
dictfunction now supports merging in of extra arguments. #395 - Added support for primitive datetimes in the contrib module. #398
- The
-
1.0.1108 Jan 2024Release notes
Open source →- Added
Environment::compile_expression_ownedto allow compiled expressions to be held without requiring a reference. #383 - Added
minijinja-embedcrate which provides a simple way to embed templates directly in the binary. #392
- Added
-
1.0.1010 Nov 2023Release notes
Open source →- Added
intandfloatfilters. #372 - Added
integerandfloattests. #373 - Fixed an issue that caused the CLI not to run when the
replfeature was disabled. #374 - Added
-n/--no-newlineoption to CLI. #375
- Added
-
1.0.918 Oct 2023Release notes
Open source →- Fixed a memory leak involving macros. Previously using macros was leaking memory due to an undetected cycle. #359
- The
debugfunction in templates can now also be used to print out the debug output of a variable. #356 - Added a new
stackerfeature which allows raising of the recursion limits. It enables monitoring of the call stack via stacker and automatically acquires additional memory when the call stack runs out of space. #354
-
1.0.817 Sep 2023Release notes
Open source →- Large integer literals in templates are now correctly handled. #353
- Relax the trait bounds of
Value::downcast_object_ref/Object::downcast_ref/Object::isand added support for downcasting of types that were directly created withValue::from_seq_objectandValue::from_struct_object. #349 - Overflowing additions on very large integers now fails rather than silently wrapping around. #350
- Fixed a few overflow panics: dividing integers with an overflow and
- Exposed missing new functionality for the Python binding. #339
-
1.0.725 Aug 2023Release notes
Open source →- Added support for
keep_trailing_newlineswhich allows you to disable the automatic trimming of trailing newlines. #334 - Added
minijinja-cliwhich lets you render and debug templates from the command line. #331 - Macros called with the wrong state will no longer panic. #330
- Debug output of
Value::UNDEFINEDandValue::from(())is nowundefinedandnonerather thanUndefinedandNone. This was an accidental inconsistency. - Fixed a potential panic in debug error printing.
- Added
Environment::set_path_join_callbackandState::get_templateto support path joining. This is for greater compatibility with Jinja2 where path joining was overridable. With this you can configure the engine so that paths used byincludeorextendscan be relative to the current template. #328 - The default auto-escape detection now accepts
.html.j2as alias for.htmlas well as for all other choices. In general.j2as an extension is now generally supported.
- Added support for
-
1.0.610 Aug 2023Release notes
Open source →- Fixed iso datetime formatting not handling negative offsets correctly. #327
- Re-report
Valuedirectly from the crate root for convenience. - It's now possible to
deserializefrom aValue. Additionally theViaDeserialize<T>argument type was added to support value conversions via serde as argument type. #325
-
1.0.518 Jul 2023Release notes
Open source →- Added the ability to merge multiple values with the
context!macro. (#317) Option<T>now acceptsnonein filters. Previously only undefined values were accepted. This bugfix might have a minor impact on code that relied in this behavior. (#320)- Fix a compilation error for
minijinja-contribif thetimezonefeature is not enabled.
- Added the ability to merge multiple values with the
-
1.0.411 Jul 2023Release notes
Open source →- Added the
args!macro which can be used to create an argument slice on the stack. (#311) - Improved error reporting for missing keyword arguments.
- Added
chronosupport to the time filters in theminijinja-contribcrate.
- Added the
-
1.0.324 Jun 2023 -
1.0.224 Jun 2023Release notes
Open source →- Added
TryFromandArgTypeforArc<str>. - Added
datetimeformat,dateformat,timeformatandnow()to the contrib crate. (#309)
- Added
-
1.0.121 Jun 2023Release notes
Open source →- Fixed a bug that caused
{% raw %}blocks to accidentally not skip the surrounding tags, causing{% raw %}and{% endraw %}to show up in output. (#307)
- Fixed a bug that caused
-
1.0.016 Jun 2023Release notes
Open source →-
Support unicode sorting for filters when the
unicodefeature is enabled. This also fixes confusing behavior when mixed types were sorted. (#299) -
Added
json5as file extension for JSON formatter. -
The autoreload crate now supports fast reloading by just clearing the already templates. This is enabled via
set_fast_reloadon theNotifier.
Note: This also includes all the changes in the different 1.0.0 alphas.
Breaking Changes
1.0 includes a lot of changes that are breaking. However they should with some minor exceptions be rather trivial changes.
-
Environment::source,Environment::set_sourceand theSourcetype together with thesourcefeature were removed. The replacement is the newloaderfeature which adds theadd_template_ownedandset_loaderAPIs. The functionality previously provided bySource::from_pathis now available viapath_loader.Old:
let mut source = Source::with_loader(|name| ...); source.add_template("foo", "...").unwrap(); let mut env = Environment::new(); env.set_source(source);New:
let mut env = Environment::new(); env.set_loader(|name| ...); env.add_template_owned("foo", "...").unwrap();Old:
let mut env = Environment::new(); env.set_source(Source::from_path("templates"));New:
let mut env = Environment::new(); env.set_loader(path_loader("templates")); -
Template::render_blockandTemplate::render_block_to_writewere replaced with APIs of the same name on theStatereturned byTemplate::eval_to_stateorTemplate::render_and_return_state:Old:
let rv = tmpl.render_block("name", ctx)?;New:
let rv = tmpl.eval_to_state(ctx)?.render_block("name")?; -
Kwargs::from_argswas removed as API as it's no longer necessary since thefrom_argsfunction now provides the same functionality:Before:
// just split let (args, kwargs) = Kwargs::from_args(values); // split and parse let (args, kwargs) = Kwargs::from_args(values); let (a, b): (i32, i32) = from_args(args)?;After:
// just split let (args, kwargs): (&[Value], Kwargs) = from_args(values)?; // split and parse let (a, b, kwargs): (i32, i32, Kwargs) = from_args(values)?; -
The
testutilsfeature andtestutilsmodule were removed. Instead you can now directly create an emptyStateand use the methods provided to invoke filters.Before:
let env = Environment::new(); let rv = apply_filter(&env, "upper", &["hello world".into()]).unwrap();After:
let env = Environment::new(); let rv = env.empty_state().apply_filter("upper", &["hello world".into()]).unwrap();Before:
let env = Environment::new(); let rv = perform_test(&env, "even", &[42.into()]).unwrap();After:
let env = Environment::new(); let rv = env.empty_state().perform_test("even", &[42.into()]).unwrap();Before:
let env = Environment::new(); let rv = format(&env, 42.into()).unwrap();After:
let env = Environment::new(); let rv = env.empty_state().format(42.into()).unwrap(); -
internand some APIs that useArc<String>now useArc<str>. This means that for instanceStructObject::fieldsreturnsArc<str>instead ofArc<String>. All the type conversions that previously acceptedArc<String>now only supportArc<str>. -
State::current_callwas removed without replacement. This information was unreliably maintained in the engine and caused issues with recursive calls. If you have a need for this API please reach out on the issue tracker. -
Output::is_discardingwas removed without replacement. This is an implementation detail and was unintentionally exposed. You should not write code that depends on the internal state of theOutput.
-
-
1.0.0-alpha.414 Jun 2023 pre-releaseRelease notes
Open source →-
Valuenow implementsOrd. This also improves the ability of the engine to sort more complex values in filters. (#295) -
Arc<String>was replaced withArc<str>in some of the public APIs where this shined through. Support for more complex key types in maps was added. You can now have tuple keys for instance. (#297)
-
-
1.0.0-alpha.312 Jun 2023 pre-releaseRelease notes
Open source →-
Removed
charas a value type. Characters are now represented as strings instead. This solves a bunch of Jinja2 incompatibilities that resulted by indexing into strings. (#292) -
Marked
ErrorKindas#[non_exhaustive]. -
Correctly handle coercing of characters and strings.
"w" == "w"[0]is now evaluating totrueas one would expect.
-