mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-02-03 22:15:42 -06:00
Add Regex for handling comment endings
Since Obsidian honors unterminated comments, these must also be filtered out, which the current Regex does not do.
This commit is contained in:
parent
f346a01296
commit
4ae56664a4
@ -130,6 +130,7 @@ export const tableWikilinkRegex = new RegExp(/(!?\[\[[^\]]*?\]\]|\[\^[^\]]*?\])/
|
||||
|
||||
const highlightRegex = new RegExp(/==([^=]+)==/g)
|
||||
const commentRegex = new RegExp(/%%[\s\S]*?%%/g)
|
||||
const commentEndRegex = new RegExp(/%%[\s\S]*?$/)
|
||||
// from https://github.com/escwxyz/remark-obsidian-callout/blob/main/src/index.ts
|
||||
const calloutRegex = new RegExp(/^\[\!([\w-]+)\|?(.+?)?\]([+-]?)/)
|
||||
const calloutLineRegex = new RegExp(/^> *\[\!\w+\|?.*?\][+-]?.*$/gm)
|
||||
@ -162,6 +163,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>>
|
||||
// do comments at text level
|
||||
if (opts.comments) {
|
||||
src = src.replace(commentRegex, "")
|
||||
src = src.replace(commentEndRegex, "")
|
||||
}
|
||||
|
||||
// pre-transform blockquotes
|
||||
|
||||
Loading…
Reference in New Issue
Block a user