Jacky Zhao
2025-04-22 2a9290b3dfedb718dbd5fc7da09775eb803f9764
fix(transclude): blockref detection
2 files modified
7 ■■■■■ changed files
quartz/components/renderPage.tsx 2 ●●● patch | view | raw | blame | history
quartz/plugins/transformers/ofm.ts 5 ●●●●● patch | view | raw | blame | history
quartz/components/renderPage.tsx
@@ -75,7 +75,7 @@
      const classNames = (node.properties?.className ?? []) as string[]
      if (classNames.includes("transclude")) {
        const inner = node.children[0] as Element
        const transcludeTarget = inner.properties["data-slug"] as FullSlug
        const transcludeTarget = (inner.properties["data-slug"] ?? slug) as FullSlug
        const page = componentData.allFiles.find((f) => f.slug === transcludeTarget)
        if (!page) {
          return
quartz/plugins/transformers/ofm.ts
@@ -191,7 +191,8 @@
          const [rawFp, rawHeader, rawAlias]: (string | undefined)[] = capture
          const [fp, anchor] = splitAnchor(`${rawFp ?? ""}${rawHeader ?? ""}`)
          const displayAnchor = anchor ? `#${anchor.trim().replace(/^#+/, "")}` : ""
          const blockRef = Boolean(rawHeader?.startsWith("#^")) ? "^" : ""
          const displayAnchor = anchor ? `#${blockRef}${anchor.trim().replace(/^#+/, "")}` : ""
          const displayAlias = rawAlias ?? rawHeader?.replace("#", "|") ?? ""
          const embedDisplay = value.startsWith("!") ? "!" : ""
@@ -221,7 +222,7 @@
                let [rawFp, rawHeader, rawAlias] = capture
                const fp = rawFp?.trim() ?? ""
                const anchor = rawHeader?.trim() ?? ""
                const alias = rawAlias?.slice(1).trim()
                const alias = rawAlias?.slice(1).trim() ?? ""
                // embed cases
                if (value.startsWith("!")) {