escape
import { escape } from "jsr:@ende/html";function
function escape(str: string): stringEscapes text for safe interpolation into HTML text content and quoted attributes.
str: stringThe string to escape.
Returns
The escaped string.
Example: Usage
import { escape } from "@ende/html/entities";
import { assertEquals } from "@ende/assert";
assertEquals(escape("<>'&AA"), "<>'&AA");
// Characters that don't need to be escaped will be left alone,
// even if named HTML entities exist for them.
assertEquals(escape("þð"), "þð");