Function unescape
- unescape(str, options?): string
Parameters
- str: string
The string to unescape.
- options: Partial<UnescapeOptions> = {}
Options for unescaping.
Returns string
The unescaped string.
Example: Basic usage
import { unescape } from "@std/html/entities";
import { assertEquals } from "@std/assert";
assertEquals(unescape("<>'&AA"), "<>'&AA");
assertEquals(unescape("þð"), "þð");Example: Using a custom entity list
This uses the full named entity list from the HTML spec (~47K un-minified)
import { unescape } from "@std/html/entities";
import entityList from "@std/html/named-entity-list.json" with { type: "json" };
import { assertEquals } from "@std/assert";
assertEquals(unescape("<>'&AA", { entityList }), "<>'&AA");- str: string
Unescapes HTML entities in text.
Default options only handle
&<>'"and numeric entities.