From a7e20804f5fe68dff7b71f3065f60e2147d633ba Mon Sep 17 00:00:00 2001
From: Sam Stokes <me@samstokes.co.uk>
Date: Tue, 05 Dec 2023 02:18:47 +0000
Subject: [PATCH] feat: Support space-delimited tags in `FrontMatter` transformer (#620)
---
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 e9510bb..4c6a6db 100644
--- a/quartz/plugins/transformers/ofm.ts
+++ b/quartz/plugins/transformers/ofm.ts
@@ -182,8 +182,9 @@
const [rawFp, rawHeader, rawAlias] = capture
const fp = rawFp ?? ""
const anchor = rawHeader?.trim().replace(/^#+/, "")
- const displayAnchor = anchor ? `#${slugAnchor(anchor)}` : ""
- const displayAlias = rawAlias ?? anchor ?? ""
+ const blockRef = Boolean(anchor?.startsWith("^")) ? "^" : ""
+ const displayAnchor = anchor ? `#${blockRef}${slugAnchor(anchor)}` : ""
+ const displayAlias = rawAlias ?? rawHeader?.replace("#", "|") ?? ""
const embedDisplay = value.startsWith("!") ? "!" : ""
return `${embedDisplay}[[${fp}${displayAnchor}${displayAlias}]]`
})
--
Gitblit v1.10.0