1 | // Type definitions for escape-html 1.0
|
2 | // Project: https://github.com/component/escape-html
|
3 | // Definitions by: Elisée MAURER <https://github.com/elisee>
|
4 | // Piotr Błażejewicz <https://github.com/peterblazejewicz>
|
5 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
6 |
|
7 | /**
|
8 | * Escape string for use in HTML
|
9 | */
|
10 |
|
11 | /**
|
12 | * Escape special characters in the given string of text, such that it can be interpolated in HTML content.
|
13 | * This function will escape the following characters: `"`, `'`, `&`, `<`, and `>`.
|
14 | *
|
15 | * *Note* that the escaped value is only suitable for being interpolated into HTML as the text content of
|
16 | * elements in which the tag does not have different escaping mechanisms (it cannot be placed inside
|
17 | * `<style>` or `<script>`, for example, as those content bodies are not HTML, but CSS and JavaScript,
|
18 | * respectively; these are known as "raw text elements" in the HTML standard).
|
19 | *
|
20 | * *Note* when using the escaped value within a tag, it is only suitable as the value of an attribute,
|
21 | * where the value is quoted with either a double quote character (`"`) or a single quote character (`'`).
|
22 | */
|
23 | declare function escapeHTML(text?: string | null): string;
|
24 |
|
25 | export = escapeHTML;
|