Minor Changes
-
124e573: Adds a new
transformSync
function, a synchronous alternative to thetransform
function. This can be used when there are noasync
transformer functions.import { transformSync, html } from "ultrahtml"; import swap from "ultrahtml/transformers/swap"; const output = transformSync(`<h1>Hello world!</h1>`, [ swap({ h1: "h2", }), ]); console.log(output); // <h2>Hello world!</h2>
-
f0a1da3: Adds a new
unblockElements
option to thesanitize
transformer. This option makes it easier to remove all or most HTML from a string without dropping child content.
Patch Changes
-
f0a1da3: Fixes sanitization of nested elements.
For example, the following code:
const output = await transform("<h1>Hello <strong>world!</strong></h1>", [ sanitize({ blockElements: ["h1", "strong"] }), ]);
produced the following output before this fix:
Hello <strong>world!</strong>
and now correctly produces:
Hello world!
-
e8aee16: Improve parser performance for attributes
-
8388fe7: Updates internal dependency on
esbuild