escape.d.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. export declare const xmlReplacer: RegExp;
  2. export declare const getCodePoint: (str: 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. */
  10. export declare function encodeXML(str: 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. */
  20. export 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. */
  28. export 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. */
  35. export 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. */
  42. export declare const escapeText: (data: string) => string;
  43. //# sourceMappingURL=escape.d.ts.map