- ebc97e0: upgrades
dts-bundle-generator
to9.2.1
, fixing an issue with.d.ts
generation which led methods prefixed with two underscores to be incorrectly made private in the generated declaration file.
- 244be0a: Update
parsel-js
to latest
- a989b5a: Bundle type definitions in
.d.ts
files
-
7c93190: Add support for static media queries to
ultrahtml/transformers/inline
.You may now pass an
env
value to the transformer, for example:import { transform } from "ultrahtml"; import inline from "ultrahtml/transformers/inline"; const output = await transform(input, [ // Acts as if the screen is 960px wide and 1280px tall inline({ env: { width: 960, height: 1280 } }), ]);
- 8bbaeef: Allow elements inside of
<svg>
to be self-closing for compactness
- 5715bc3: Fix
sanitize
transformer behavior when only usingallowElements
- 0556b19: Add
renderSync
export
- 3362aa2: Add
main
entrypoint
- 7792f5d: Add
useObjectSyntax
option to inline transformer. Note that this option is currently not compatible withtransform
- d910619: Remove
resolveAsset
option frominline
transformer, making it synchronous again.
- c5799aa: Update attribute handling to account for attributes with newlines
- d7cb17d: Fix another edge case with text inside script/styles
- c7a1ef6: Fix edge case with
<script>
parsing
- b136e51: Fix unhandled edge case with
sanitize
transformer - dce0b68: Fix style and script elements having their contents parsed as HTML
-
95c0f73:
ultrahtml
is a complete markup toolkit with a tiny footprint. Parse, transform, and render HTML on the server, in the browser, with or without a build step.The signature of
transform
has been updated. Rather than applying sanitization and component swapping by default, these have been split out to individualultrahtml/transformers
that can be applied modularly.In
[email protected]
,transform
accepted an options object withsanitize
andcomponents
. Other transformations would need to be applied outside of this flow.import { transform } from "ultrahtml"; await transform(markup, { components: { h1: "h2" }, sanitize: { allowElements: ["h1", "h2", "h3"] }, });
In
[email protected]
,transform
accepts an array of transformers to apply. Thesanitize
andcomponents
options can be handled with the built-in transformers namedsanitize
andswap
.import { transform } from "ultrahtml"; import swap from "ultrahtml/transformers/swap"; import sanitize from "ultrahtml/transformers/sanitize"; await transform(markup, [ swap({ h1: "h2" }), sanitize({ allowElements: ["h1", "h2", "h3"] }), ]);
ultrahtml
now comes withh
andFragment
functions for JSX, as well as ajsx-runtime
export.Transformers are AST transformations that can be applied to any
ultrahtml
Node. Usually these are applied to entire documents.New
inline
transformer inlines CSS from<style>
blocks directly to matching elements.New
scope
transformer scopes CSS from<style>
blocks to the elements in a given document or component.
- 4699020: Update JSX runtime child handling
- da119c1: Fix transformer definitions
- d29a0e2: Add
resolveAsset
option to theinline
transformer - 401b13a: Fix JSX runtime types
- 44a771e: Update list of void HTML tags
- d29a0e2: Add
resolveAsset
option to theinline
transformer
- 4699020: Update JSX runtime child handling
- 401b13a: Fix JSX runtime types
- da119c1: Fix transformer definitions
-
95c0f73:
ultrahtml
is a complete markup toolkit with a tiny footprint. Parse, transform, and render HTML on the server, in the browser, with or without a build step.The signature of
transform
has been updated. Rather than applying sanitization and component swapping by default, these have been split out to individualultrahtml/transformers
that can be applied modularly.In
[email protected]
,transform
accepted an options object withsanitize
andcomponents
. Other transformations would need to be applied outside of this flow.import { transform } from "ultrahtml"; await transform(markup, { components: { h1: "h2" }, sanitize: { allowElements: ["h1", "h2", "h3"] }, });
In
[email protected]
,transform
accepts an array of transformers to apply. Thesanitize
andcomponents
options can be handled with the built-in transformers namedsanitize
andswap
.import { transform } from "ultrahtml"; import swap from "ultrahtml/transformers/swap"; import sanitize from "ultrahtml/transformers/sanitize"; await transform(markup, [ swap({ h1: "h2" }), sanitize({ allowElements: ["h1", "h2", "h3"] }), ]);
ultrahtml
now comes withh
andFragment
functions for JSX, as well as ajsx-runtime
export.Transformers are AST transformations that can be applied to any
ultrahtml
Node. Usually these are applied to entire documents.New
inline
transformer inlines CSS from<style>
blocks directly to matching elements.New
scope
transformer scopes CSS from<style>
blocks to the elements in a given document or component.
- 83c2e35: Improve declarations for node types
- 3b8fb6e: Remove bundledDependencies field
- 74010dd: Bundle parsel-js to avoid ESM/CJS issues
- d7b514d: Fix CJS compat issue (again)
- a105c5e: Fix CJS compat issue
-
2de70f3: Add
ultrahtml/selector
module which exportsquerySelector
,querySelectorAll
, andmatches
functions.To use
querySelectorAll
, pass the rootNode
as the first argument and any valid CSS selector as the second argument. Note that if a CSS selector you need is not yet implemented, you are invited to open an issue.import { parse } from "ultrahtml"; import { querySelectorAll, matches } from "ultrahtml/selector"; const doc = parse(` <html> <head> <title>Demo</title> /head> <body> <h1>Hello world!</h1> </body> </html> `); const h1 = querySelector(doc, "h1"); const match = matches(h1, "h1");
- 037711f: Update types
- 97b297f: Add
walkSync
export
- 123f7ea: Fix custom elements transform.
- 758bbba: Improve documentation
- 2f92e93: Export node types
- 517e24d: Fix edge cases with text node detection, refactor for compactness
- 23771a3: Fix
walk
function definition
- 4d082b3: Ensure types are included
- e0e8a2b: Add
__unsafeHTML
export
- f6e3a71: Support async components