Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/vento/deps.ts>html.unescape

🌬 A template engine for Deno & Node
Go to Latest
function html.unescape
import { html } from "https://deno.land/x/vento@v0.11.0/deps.ts";
const { unescape } = html;

Unescapes HTML entities in text

Examples

Example 1

import { unescape } from "https://deno.land/std@0.224.0/html/entities.ts";
import { assertEquals } from "https://deno.land/std@0.224.0/assert/assert_equals.ts";

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

// using the full named entity list from the HTML spec (~47K unminified)
import entityList from "https://deno.land/std@0.224.0/html/named_entity_list.json" assert { type: "json" };
assertEquals(unescape("&thorn;&eth;", { entityList }), "þð");

Parameters

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

Returns

string