From cc0f8c7218268678a94340876ce1e1f9296232f5 Mon Sep 17 00:00:00 2001 From: codecalm Date: Tue, 22 Sep 2026 12:06:39 +0200 Subject: [PATCH] Put every BEGIN/END marker comment on its own line in the built HTML --- preview/.build/prettify-html-worker.mjs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/preview/.build/prettify-html-worker.mjs b/preview/.build/prettify-html-worker.mjs index c581f9ce6..65a194f8e 100644 --- a/preview/.build/prettify-html-worker.mjs +++ b/preview/.build/prettify-html-worker.mjs @@ -12,7 +12,16 @@ for (const file of files) { const source = readFileSync(file, 'utf8') // Astro appends "overflow-x: auto" to the shiki
 style — the Eleventy
   // pipeline doesn't have it and HTML is the product: restore 1:1.
-  const cleaned = source.replaceAll('; overflow-x: auto;', '')
+  const cleaned = source
+    .replaceAll('; overflow-x: auto;', '')
+    // Give every  marker its own line. Prettier keeps a
+    // comment glued to whatever touches it (an inline , the next marker), so
+    // a component rendered in a .map() came out as
+    // ``. Only a
+    // marker with a non-space neighbour gets a newline, so nothing that is
+    // already on its own line gains a blank line (prettier would keep it).
+    .replaceAll(/(?<=\S)(?=)/g, '\n')
+    .replaceAll(/(?<=)(?=\S)/g, '\n')
   // filepath is not redundant next to parser: "html" — prettier's printer keys
   // some output off it, and without it the doctype comes out as 
   // instead of the  the prettier CLI writes.