apps-script-utils 2.1.1 Help

escapeHtml

function escapeHtml(value: string): string;

<, >, &, " and ' become named entities. This is what to call on anything a user supplied before it reaches an HtmlOutput or a template.

Parameters

Parameter

Type

Description

value

string

The string to convert. It must not be empty.

Returns

string — the escaped string.

Throws

Exception

Condition

EmptyStringException

the value is not a string, or is empty.

Examples

Converting

escapeHtml("<a>&"); // => "&lt;a&gt;&amp;"

See also

Source

src/html/escapeHtml.ts

23 September 2026

This documentation was generated with AI (Claude) from the library's source code.