fix: deep clone before relativizing urls in transclude (closes #640)
| | |
| | | "remark-parse": "^11.0.0", |
| | | "remark-rehype": "^11.0.0", |
| | | "remark-smartypants": "^2.0.0", |
| | | "rfdc": "^1.3.0", |
| | | "rimraf": "^5.0.5", |
| | | "serve-handler": "^6.1.5", |
| | | "shikiji": "^0.9.9", |
| | |
| | | "node": ">=0.10.0" |
| | | } |
| | | }, |
| | | "node_modules/rfdc": { |
| | | "version": "1.3.0", |
| | | "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", |
| | | "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==" |
| | | }, |
| | | "node_modules/rimraf": { |
| | | "version": "5.0.5", |
| | | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.5.tgz", |
| | |
| | | "remark-parse": "^11.0.0", |
| | | "remark-rehype": "^11.0.0", |
| | | "remark-smartypants": "^2.0.0", |
| | | "rfdc": "^1.3.0", |
| | | "rimraf": "^5.0.5", |
| | | "serve-handler": "^6.1.5", |
| | | "shikiji": "^0.9.9", |
| | |
| | | import { slug as slugAnchor } from "github-slugger" |
| | | import type { Element as HastElement } from "hast" |
| | | import rfdc from "rfdc" |
| | | |
| | | const clone = rfdc() |
| | | |
| | | // this file must be isomorphic so it can't use node libs (e.g. path) |
| | | |
| | | export const QUARTZ = "quartz" |
| | |
| | | } |
| | | } |
| | | |
| | | export function normalizeHastElement(el: HastElement, curBase: FullSlug, newBase: FullSlug) { |
| | | export function normalizeHastElement(rawEl: HastElement, curBase: FullSlug, newBase: FullSlug) { |
| | | const el = clone(rawEl) // clone so we dont modify the original page |
| | | _rebaseHastElement(el, "src", curBase, newBase) |
| | | _rebaseHastElement(el, "href", curBase, newBase) |
| | | if (el.children) { |