JsRender Demos
Using {{: }} or {{> }} to render data values with optional conversion or HTML encoding
- {{:value}} does not convert. Used to render values that include html markup
- {{loc:value}} Uses custom converter.
- {{html:value}} Converts using built-in HTML encoder. (Better security, but slight perf cost)
- {{>value}} Alternative syntax for built-in HTML 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, other encoders can easily be registered, such as an attribute encoder, {{attr: }}.
Title (loc:French) | No Convert | HTML Encode |