Skip to content

Commit 5ec6146

Browse files
authored
fix(wikilinks): proper escaping of pipe character in wikilinks inside tables (#1040)
1 parent aa4f529 commit 5ec6146

File tree

1 file changed

+2
-1
lines changed
  • quartz/plugins/transformers

1 file changed

+2
-1
lines changed

quartz/plugins/transformers/ofm.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>
188188
const [raw]: (string | undefined)[] = capture
189189
let escaped = raw ?? ""
190190
escaped = escaped.replace("#", "\\#")
191-
escaped = escaped.replace("|", "\\|")
191+
// escape pipe characters if they are not already escaped
192+
escaped = escaped.replace(/((^|[^\\])(\\\\)*)\|/g, "$1\\|")
192193

193194
return escaped
194195
})

0 commit comments

Comments
 (0)