apps-script-utils 2.1.1 Help

encodeHtml

function encodeHtml(value: string): string;

Unlike escapeHtml, which touches only the five dangerous characters, this rewrites the whole string as &#NN; references. decodeHtml is its inverse.

Parameters

Parameter

Type

Description

value

string

The string to convert. It must not be empty.

Returns

string — the encoded string.

Throws

Exception

Condition

EmptyStringException

the value is not a string, or is empty.

Examples

Converting

encodeHtml("<a>"); // => "&#60;a&#62;"

See also

Source

src/html/encodeHtml.ts

23 September 2026

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