@technobuddha > library > Programming > Escaping
Function: escapeHTML()
ts
function escapeHTML(input: string, options: EscapeHtmlOptions): string;Defined in: escape-html.ts:26
Escape a string for use in HTML
Parameters
| Parameter | Type | Description |
|---|---|---|
input | string | The string to escape |
options | EscapeHtmlOptions | see EscapeHtmlOptions |
Returns
string
Example
typescript
escapeHTML('<div>hello</div>'); // '<div>hello</div>';
escapeHTML('aáΔ😀', { escapeNonASCII: true }); // 'aáΔ😀';