fix: bad transform in wikilink pre-transform (closes #598)

This commit is contained in:
Jacky Zhao 2023-11-17 14:00:49 -08:00
parent 3f0be7fbe4
commit 6a05fa777c

View file

@ -183,7 +183,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>
const fp = rawFp ?? "" const fp = rawFp ?? ""
const anchor = rawHeader?.trim().replace(/^#+/, "") const anchor = rawHeader?.trim().replace(/^#+/, "")
const displayAnchor = anchor ? `#${slugAnchor(anchor)}` : "" const displayAnchor = anchor ? `#${slugAnchor(anchor)}` : ""
const displayAlias = rawAlias ?? anchor ?? "" const displayAlias = rawAlias ?? rawHeader?.replace("#", "|") ?? ""
const embedDisplay = value.startsWith("!") ? "!" : "" const embedDisplay = value.startsWith("!") ? "!" : ""
return `${embedDisplay}[[${fp}${displayAnchor}${displayAlias}]]` return `${embedDisplay}[[${fp}${displayAnchor}${displayAlias}]]`
}) })