diff --git a/quartz/plugins/transformers/text/htmlComments.ts b/quartz/plugins/transformers/text/htmlComments.ts
index 49e3c6ed2ecf2..dd3da780a3c65 100644
--- a/quartz/plugins/transformers/text/htmlComments.ts
+++ b/quartz/plugins/transformers/text/htmlComments.ts
@@ -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
},
diff --git a/quartz/plugins/transformers/text/ofmComments.ts b/quartz/plugins/transformers/text/ofmComments.ts
index dbf0224961149..82a1e1c95b718 100644
--- a/quartz/plugins/transformers/text/ofmComments.ts
+++ b/quartz/plugins/transformers/text/ofmComments.ts
@@ -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
},