Escapes text for safe interpolation into HTML text content and quoted attributes.
The string to escape.
The escaped string.
import { escape } from "@std/html/entities";import { assertEquals } from "@std/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("þð"), "þð"); Copy
import { escape } from "@std/html/entities";import { assertEquals } from "@std/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("þð"), "þð");
Escapes text for safe interpolation into HTML text content and quoted attributes.