fix(wikilinks): proper escaping of pipe character in wikilinks inside tables (#1040)

This commit is contained in:
Emile Bangma 2024-03-31 18:44:50 +02:00 committed by GitHub
parent aa4f5294a3
commit 5ec61468d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -188,7 +188,8 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>
const [raw]: (string | undefined)[] = capture
let escaped = raw ?? ""
escaped = escaped.replace("#", "\\#")
escaped = escaped.replace("|", "\\|")
// escape pipe characters if they are not already escaped
escaped = escaped.replace(/((^|[^\\])(\\\\)*)\|/g, "$1\\|")
return escaped
})