• Version 1.0.4
  • Published
  • 4.45 kB
  • No dependencies
  • MIT license


npm i @types/escape-html
yarn add @types/escape-html
pnpm add @types/escape-html


TypeScript definitions for escape-html




function escapeHTML

escapeHTML: (text?: string | null) => string;
  • Escape special characters in the given string of text, such that it can be interpolated in HTML content. This function will escape the following characters: ", ', &, <, and >.

    *Note* that the escaped value is only suitable for being interpolated into HTML as the text content of elements in which the tag does not have different escaping mechanisms (it cannot be placed inside <style> or <script>, for example, as those content bodies are not HTML, but CSS and JavaScript, respectively; these are known as "raw text elements" in the HTML standard).

    *Note* when using the escaped value within a tag, it is only suitable as the value of an attribute, where the value is quoted with either a double quote character (") or a single quote character (').

Package Files (1)

Dependencies (0)

No dependencies.

Dev Dependencies (0)

No dev dependencies.

Peer Dependencies (0)

No peer dependencies.


To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/escape-html.

  • Markdown
  • HTML
    <a href="https://www.jsdocs.io/package/@types/escape-html"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>