Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/html/mod.ts>unescape

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function unescape
import { unescape } from "https://deno.land/std@0.211.0/html/mod.ts";

Unescapes HTML entities in text.

Examples

Example 1

import { unescape } from "https://deno.land/std@0.211.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.211.0/html/named_entity_list.json" assert { type: "json" };

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

Parameters

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

Returns

string