unsafelyRenderString API

How to use the unsafelyRenderString function to render a string variable that includes html code.


Description

The unsafelyRenderString function is used to render a string variable that includes html code. This is needed because by default, for security reasons, Wompo escapes HTML code that is included in string variables included in a template. To avoid this automatic escaping, you should use the unsafelyRenderString function.


Usage

const escaped = unsafelyRenderString(variable);

The unsafelyRenderString function accepts one single argument, which is the string variable that will be escaped.

Only use this function when you are absolutely sure that the variable doesnt include dangerous code. Avoid this approach when your variable arrives from the final user's input.