Keats / tera

A template engine for Rust based on Jinja2/Django
http://keats.github.io/tera/
MIT License
3.43k stars 279 forks source link

[docs] Tera overview should describe safe filter in the autoescaping section #849

Open jmeowmeow opened 1 year ago

jmeowmeow commented 1 year ago

The docs should follow Jinja in explaining the " | safe" filter in the context of autoescaping, to avoid new adopters getting confused as to why internally configured URL references like {{ config.base_url }} are uselessly escaped.

Tera Autoescaping: https://tera.netlify.app/docs/#auto-escaping

Tera Docs Source (Autoescaping): https://github.com/Keats/tera/blob/0f6d00d31583168b85498c7690f045bc42ce7511/docs/content/docs/_index.md?plain=1#L102

Jinja Autoescaping and "safe" in context: https://jinja.palletsprojects.com/en/3.1.x/templates/#working-with-automatic-escaping

If you know you have data that is already safe but not marked, be sure to wrap it in Markup or use the |safe filter.

Jinja functions (macros, super, self.BLOCKNAME) always return template data that is marked as safe.

New adopter unaware of |safe : https://zola.discourse.group/t/adding-canonical-links-to-pages/1495