This commit is contained in:
saberzero1 2024-10-31 19:51:59 +01:00
parent f64e277ca2
commit 1f9ee4735e
No known key found for this signature in database
GPG Key ID: 41AEE99107640F10
2 changed files with 6 additions and 6 deletions

View File

@ -11,16 +11,16 @@ export const HtmlComments: TextTransformerPlugin = () => {
if (src instanceof Buffer) {
src = src.toString()
} // capture all codeblocks before parsing comments
const codeBlocks = Array.from(src.matchAll(codeBlockRegex), (x) => x[1].toString())
const codeBlocks = Array.from(src.matchAll(codeBlockRegex), (x) => x[1])
src = src.replaceAll(codeBlockRegex, "###codeblockplaceholder###")
src = src.replaceAll(commentRegex, "")
// Restore codeblocks
codeBlocks.forEach((codeblock) => {
for (const codeblock of codeBlocks) {
src = src.replace("###codeblockplaceholder###", codeblock)
})
}
return src
},

View File

@ -19,10 +19,10 @@ export const ObsidianFlavoredMarkdownComments: TextTransformerPlugin = () => {
src = src.replaceAll(commentRegex, "")
// Restore codeblocks
codeBlocks.forEach((codeblock) => {
// Restore codeblock
for (const codeblock of codeBlocks) {
src = src.replace("###codeblockplaceholder###", codeblock)
})
}
return src
},