mrdocs::HTMLEscape

HTML escapes the specified string

Synopsis

Declared in <mrdocs/Support/Handlebars.hpp>

void
HTMLEscape(
    OutputRef& out,
    std::string_view str);

Description

This function HTML escapes the specified string, making it safe for rendering as text within HTML content.

Replaces &, <, >, ", ', `, `=` with the HTML entity equivalent value for string values.

The output of all expressions except for triple‐braced expressions are passed through this method. Helpers should also use this method when returning HTML content via a SafeString instance, to prevent possible code injection.

Helper values created by the SafeString function are left untouched by the template and are not passed through this function.

This function has the same behavior as the corresponding utility function in the Handlebars.js library.

Parameters

Name Description

out

The output stream reference where the escaped string will be written.

str

The string to escape.

See Also

https://github.com/handlebars‐lang/handlebars.js/blob/master/lib/handlebars/utils.js

Created with MrDocs