Skip to content

Latest commit

 

History

History
93 lines (86 loc) · 2.68 KB

html.md

File metadata and controls

93 lines (86 loc) · 2.68 KB

Custom HTML Helpers

These helpers provide some ability to manage strings for use within html content.


Helpers.Html.Escape

Summary An escape function similar to what exists in javascript. This will compute a new string which certain characters have been replaced by a hexadecimal escape sequence
Returns The newly escaped string
Remarks / characters will be escaped with a |
Parameters
str String to escape

Example

Context

{
    "value": "https://github.com/arinet/HandlebarDocs/blob/master/html.md#helpershtmlescape"
}

Usage

<strong>result:</strong>
{{Helpers.Html.Escape value}}

Returns

<strong>result:</strong>
https:\/\/github.com\/arinet\/HandlebarDocs\/blob\/master\/docs\/html.md#helpershtmlescape

Helpers.Html.HtmlDecode

Summary Converts a string that has been HTML-encoded for HTTP transmission
Returns Decoded string
Remarks If characters such as blanks and punctuation are passed in an HTTP stream, they might be misinterpreted at the receiving end. HTML encoding converts characters that are not allowed in HTML into character-entity equivalents; HTML decoding reverses the encoding. For example, when embedded in a block of text, the characters < and > are encoded as < and > for HTTP transmission.
Parameters
html String to decode

Example

Context

{
    "value": "Enter a string having &#39;&amp;&#39; or &#39;&quot;&#39;  in it:"
}

Usage

<strong>result:</strong>
{{Helpers.Html.HtmlDecode value}}

Returns

<strong>result:</strong>
Enter a string having '&' or '"'  in it:

Helpers.Html.HtmlEncode

Summary Converts a string to an HTML-encoded string
Returns Encoded string
Remarks If characters such as blanks and punctuation are passed in an HTTP stream, they might be misinterpreted at the receiving end. HTML encoding converts characters that are not allowed in HTML into character-entity equivalents; HTML decoding reverses the encoding. For example, when embedded in a block of text, the characters < and > are encoded as < and > for HTTP transmission.
Parameters
html String to encode

Example

Context

{
    "value": "Enter a string having '&' or '\"'  in it:"
}

Usage

<strong>result:</strong>
{{Helpers.Html.HtmlEncode value}}

Returns

<strong>result:</strong>
Enter a string having &#39;&amp;&#39; or &#39;&quot;&#39;  in it: