Skip to content

v1.6.0

Latest
Compare
Choose a tag to compare
@github-actions github-actions released this 04 Apr 02:15
· 2 commits to main since this release
16326ce

Minor Changes

  • 124e573: Adds a new transformSync function, a synchronous alternative to the transform function. This can be used when there are no async 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 the sanitize 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