mrdocs::HTMLEscape

HTML escapes the specified string.

Synopsis

Declared in <mrdocs/Support/Handlebars.hpp>

std::string
HTMLEscape(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.

Return Value

The escaped string.

Parameters

Name Description

str

The string to escape.

Created with MrDocs