Skip to main content
Module

std/html/mod.ts>unescape

The Deno Standard Library
Go to Latest
function unescape
import { unescape } from "https://deno.land/std@0.223.0/html/mod.ts";

Unescapes HTML entities in text.

Examples

Example 1

import { unescape } from "https://deno.land/std@0.223.0/html/entities.ts";

// Default options (only handles &<>'" and numeric entities)
unescape("&lt;&gt;&apos;&amp;&#65;&#x41;"); // "<>'&AA"
unescape("&thorn;&eth;"); // "&thorn;&eth;"

// Using the full named entity list from the HTML spec (~47K un-minified)
import entityList from "https://deno.land/std@0.223.0/html/named_entity_list.json" with { type: "json" };

unescape("&thorn;&eth;", { entityList }); // "þð"

Parameters

str: string
optional
options: Partial<UnescapeOptions> = [UNSUPPORTED]

Returns

string