From 2a9290b3dfedb718dbd5fc7da09775eb803f9764 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Tue, 22 Apr 2025 18:18:50 +0000
Subject: [PATCH] fix(transclude): blockref detection

---
 quartz/plugins/transformers/ofm.ts |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts
index 5c2f4b2..dada7d4 100644
--- a/quartz/plugins/transformers/ofm.ts
+++ b/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("!")) {

--
Gitblit v1.10.0