UNPKG

1.54 kBTypeScriptView Raw
1export declare const xmlReplacer: RegExp;
2export declare const getCodePoint: (c: string, index: number) => number;
3/**
4 * Encodes all non-ASCII characters, as well as characters not valid in XML
5 * documents using XML entities.
6 *
7 * If a character has no equivalent entity, a
8 * numeric hexadecimal reference (eg. `ü`) will be used.
9 */
10export declare function encodeXML(input: string): string;
11/**
12 * Encodes all non-ASCII characters, as well as characters not valid in XML
13 * documents using numeric hexadecimal reference (eg. `ü`).
14 *
15 * Have a look at `escapeUTF8` if you want a more concise output at the expense
16 * of reduced transportability.
17 *
18 * @param data String to escape.
19 */
20export declare const escape: typeof encodeXML;
21/**
22 * Encodes all characters not valid in XML documents using XML entities.
23 *
24 * Note that the output will be character-set dependent.
25 *
26 * @param data String to escape.
27 */
28export declare const escapeUTF8: (data: string) => string;
29/**
30 * Encodes all characters that have to be escaped in HTML attributes,
31 * following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}.
32 *
33 * @param data String to escape.
34 */
35export declare const escapeAttribute: (data: string) => string;
36/**
37 * Encodes all characters that have to be escaped in HTML text,
38 * following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}.
39 *
40 * @param data String to escape.
41 */
42export declare const escapeText: (data: string) => string;
43//# sourceMappingURL=escape.d.ts.map
\No newline at end of file