JsRender Demos
Using {{: }} or {{> }} to render data values with optional conversion or encoding
- {{:value}} — does not convert. Used to render values that include html markup.
- {{loc:value lang="..."}} — Uses custom converter.
- {{html:value}} — Converts using built-in HTML encoder. (Better security within element content, but slight perf cost).
- {{>value}} — Alternative syntax for built-in HTML encoder.
- {{attr:availability}} — Converts using built-in attribute encoder. (Better security within attributes).
- {{url:value lang="..."}} — Converts using built-in URL encoder.
Note: A common use for converters is to protect against injection attacks from untrusted data.
It is generally best to use {{> }} when rendering data within element content, if the data is not intended to provide markup for insertion in the DOM.
In the context of HTML attributes, use {{attr: }}.
Title (loc:English) | Title (loc:French) | No Convert | HTML Encode |