utils/dist
saberzero1 bb5c136296
feat(path): add normalizeHastElement for cross-slug HAST rebasing
Moved from Quartz core (quartz/util/path.ts) into the shared utils
package so that plugins performing cross-slug HAST embedding can
re-use the same rebase helper as Quartz's internal transclude
expansion, rather than reimplementing or skipping the rebase.

The primary consumer outside of Quartz core is canvas-page, whose
buildEmbeddedContent() pulls vfile.data.htmlAst from arbitrary target
pages and serializes it verbatim into canvas pages - producing broken
relative hrefs that survive accidentally on root deployments but fail
under non-trivial basePath configurations. Exposing the helper here
lets canvas-page (and any future embedding plugin) rebase correctly
without duplicating the logic.

Implementation details:
- Deep-clones the input via structuredClone (Node >=22 builtin) so
  callers don't need to bring their own clone function
- Absolute URLs (http://, https://, /root-relative) pass through
  untouched; only relative URLs are rebased
- Recurses into children so nested anchors inside a rebased subtree
  are also normalized

Backed by 10 new tests covering same-slug, cross-slug (both directions),
nested depth, anchor preservation, absolute URL passthrough, root-relative
passthrough, src-attribute rebasing, elements without href/src, nested
children recursion, and input-immutability.
2026-04-17 02:24:33 +02:00
..
date.d.ts feat: add formatDate and getIconCode utility exports 2026-04-03 15:04:35 +02:00
date.js feat: add formatDate and getIconCode utility exports 2026-04-03 15:04:35 +02:00
date.js.map feat: add formatDate and getIconCode utility exports 2026-04-03 15:04:35 +02:00
dom.d.ts feat: add formatDate and getIconCode utility exports 2026-04-03 15:04:35 +02:00
dom.js feat: add formatDate and getIconCode utility exports 2026-04-03 15:04:35 +02:00
dom.js.map chore: commit dist/ and remove prepare script 2026-03-14 21:30:17 +01:00
emoji.d.ts feat: add formatDate and getIconCode utility exports 2026-04-03 15:04:35 +02:00
emoji.js feat: add formatDate and getIconCode utility exports 2026-04-03 15:04:35 +02:00
emoji.js.map feat: add formatDate and getIconCode utility exports 2026-04-03 15:04:35 +02:00
escape.d.ts chore: commit dist/ and remove prepare script 2026-03-14 21:30:17 +01:00
escape.js feat: add formatDate and getIconCode utility exports 2026-04-03 15:04:35 +02:00
escape.js.map chore: commit dist/ and remove prepare script 2026-03-14 21:30:17 +01:00
index.d.ts feat(path): add normalizeHastElement for cross-slug HAST rebasing 2026-04-17 02:24:33 +02:00
index.js feat(path)!: lowercase slugs for Obsidian-parity case-insensitive matching 2026-04-16 21:12:37 +02:00
index.js.map feat(path): add normalizeHastElement for cross-slug HAST rebasing 2026-04-17 02:24:33 +02:00
jsx.d.ts feat: add formatDate and getIconCode utility exports 2026-04-03 15:04:35 +02:00
jsx.js feat: add formatDate and getIconCode utility exports 2026-04-03 15:04:35 +02:00
jsx.js.map chore: commit dist/ and remove prepare script 2026-03-14 21:30:17 +01:00
lang.d.ts chore: commit dist/ and remove prepare script 2026-03-14 21:30:17 +01:00
lang.js feat: add formatDate and getIconCode utility exports 2026-04-03 15:04:35 +02:00
lang.js.map chore: commit dist/ and remove prepare script 2026-03-14 21:30:17 +01:00
path.d.ts feat(path): add normalizeHastElement for cross-slug HAST rebasing 2026-04-17 02:24:33 +02:00
path.js feat(path): add normalizeHastElement for cross-slug HAST rebasing 2026-04-17 02:24:33 +02:00
path.js.map feat(path): add normalizeHastElement for cross-slug HAST rebasing 2026-04-17 02:24:33 +02:00
sort.d.ts feat: add getDate and byDateAndAlphabetical sort utilities 2026-04-03 15:39:35 +02:00
sort.js fix: safely handle undefined getDate in byDateAndAlphabetical 2026-04-03 15:58:13 +02:00
sort.js.map fix: safely handle undefined getDate in byDateAndAlphabetical 2026-04-03 15:58:13 +02:00