This commit is contained in:
giselle197 2026-01-28 16:41:23 +00:00 committed by GitHub
commit 8c1a89090a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -161,7 +161,13 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>>
textTransform(_ctx, src) {
// do comments at text level
if (opts.comments) {
src = src.replace(commentRegex, "")
// Remove %% comments %% outside of codeblocks
const codeblockRegex = /```[\s\S]*?```|`[^`\n]+`/
const codeblockOrCommentRegex = new RegExp(
`(${codeblockRegex.source})|${commentRegex.source}`,
"g",
)
src = src.replace(codeblockOrCommentRegex, (_match, codeblock) => codeblock ?? "")
}
// pre-transform blockquotes