From 3367b927a466b94db3a4ef6d29860c252dad0d83 Mon Sep 17 00:00:00 2001 From: Blake Date: Sat, 4 Jul 2026 08:06:00 +0900 Subject: [PATCH] fix: Mermaid tab UI never rendered due to wrong sibling lookup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit enhanceMermaidTabs looked for the code block via diagram.previousElementSibling, expecting a pre[data-language="mermaid"] right before the .mermaid div. But the actual markup (from the remarkMermaid plugin in astro.config.mjs) wraps the diagram in its own
, with the source code living in a separate
that follows the figure — so previousElementSibling was always null and the tabs never built. This was already broken on main before any of the recent work; unrelated to it. Look up the diagram/code pair from the figure and its next sibling details block instead, and remove the now-empty figure/details shells once their contents are moved into the tab panels. Verified with Playwright against a production preview build: all 4 diagrams on a test post get Mermaid/Code tab pairs, switching tabs shows the correct content, tab state survives a theme toggle (re-render from the earlier Mermaid dark/light fix keeps working underneath), and no leftover empty figure/details elements remain. --- src/pages/blog/[...slug].astro | 158 +++++++++++++++++---------------- 1 file changed, 82 insertions(+), 76 deletions(-) diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index cea92e0..e6a7b0a 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -270,85 +270,91 @@ const blogPostingStructuredData = {