Skip to content

feat(environment): add auto escape callback for templates - #902

Open
qlux wants to merge 1 commit into
mitsuhiko:mainfrom
qlux:main
Open

feat(environment): add auto escape callback for templates#902
qlux wants to merge 1 commit into
mitsuhiko:mainfrom
qlux:main

Conversation

@qlux

@qlux qlux commented May 26, 2026

Copy link
Copy Markdown

Expose the autoescape parameter to the js binding.


Co-Authored-By: Claude Opus noreply@anthropic.com

---
Co-Authored-By: Claude Opus <noreply@anthropic.com>"

@mitsuhiko mitsuhiko left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The core html/json/none behavior works locally, but I don't think this is ready to merge yet:

  • The custom-format branch leaks a new allocation on every callback invocation via Box::leak. The JS binding does not expose a custom formatter, so this advertised mode cannot actually render and currently just errors. Please restrict the return values to the supported modes (or otherwise avoid the per-call leak).
  • Please add JS tests covering the callback/name and escaping behavior.
  • Please update minijinja-js/README.md, which still lists custom auto-escape callbacks as unsupported.

I verified that the branch compiles and that the existing JS test suite passes after merging current main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants