<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Javascript on Nick Liu - Software Engineer</title><link>https://nick-liu.com/tags/javascript/</link><description>Recent content in Javascript on Nick Liu - Software Engineer</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>nickboy@users.noreply.github.com (Nick Liu)</managingEditor><webMaster>nickboy@users.noreply.github.com (Nick Liu)</webMaster><copyright>2026 Nick Liu</copyright><lastBuildDate>Sun, 02 Aug 2026 13:49:57 -0700</lastBuildDate><atom:link href="https://nick-liu.com/tags/javascript/index.xml" rel="self" type="application/rss+xml"/><item><title>My diagrams rendered on refresh and vanished on click. The head never loaded.</title><link>https://nick-liu.com/posts/htmx-vendor-bundles-blowfish/</link><pubDate>Tue, 11 Aug 2026 00:00:00 +0000</pubDate><author>nickboy@users.noreply.github.com (Nick Liu)</author><guid>https://nick-liu.com/posts/htmx-vendor-bundles-blowfish/</guid><description>&lt;div class="lead text-neutral-500 dark:text-neutral-400 !mb-9 text-xl"&gt;
 
A reader clicking from my homepage to a post with a diagram got a block of raw mermaid source. The same reader pasting that post's URL directly got a rendered diagram. Same page, same build, same browser. The difference was the click, and the bug had been live on this site for months across every diagram, every math formula, and every chart, because I had only ever tested pages by loading them directly.

&lt;/div&gt;

&lt;div class="tested-with" role="note"&gt;
 &lt;span class="tested-with-icon" aria-hidden="true"&gt;🧪&lt;/span&gt;
 &lt;span&gt;Tested with &lt;strong&gt;Blowfish&lt;/strong&gt; &lt;code&gt;2.10x&lt;/code&gt; · htmx 2.0.10&lt;/span&gt;
&lt;/div&gt;


&lt;h2 class="relative group"&gt;Two features, both reasonable, one collision
 &lt;div id="two-features-both-reasonable-one-collision" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#two-features-both-reasonable-one-collision" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;This site has htmx&amp;rsquo;s &lt;code&gt;hx-boost&lt;/code&gt; on the body: internal navigation swaps page content in place instead of doing full page loads, which keeps transitions smooth. Separately, the Blowfish theme is smart about heavy libraries: mermaid, KaTeX, and Chart.js bundles are only included on pages that use them, injected into the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; of exactly those pages.&lt;/p&gt;</description><content:encoded>&lt;div class="lead text-neutral-500 dark:text-neutral-400 !mb-9 text-xl"&gt;
 
A reader clicking from my homepage to a post with a diagram got a block of raw mermaid source. The same reader pasting that post's URL directly got a rendered diagram. Same page, same build, same browser. The difference was the click, and the bug had been live on this site for months across every diagram, every math formula, and every chart, because I had only ever tested pages by loading them directly.

&lt;/div&gt;

&lt;div class="tested-with" role="note"&gt;
 &lt;span class="tested-with-icon" aria-hidden="true"&gt;🧪&lt;/span&gt;
 &lt;span&gt;Tested with &lt;strong&gt;Blowfish&lt;/strong&gt; &lt;code&gt;2.10x&lt;/code&gt; · htmx 2.0.10&lt;/span&gt;
&lt;/div&gt;


&lt;h2 class="relative group"&gt;Two features, both reasonable, one collision
 &lt;div id="two-features-both-reasonable-one-collision" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#two-features-both-reasonable-one-collision" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;This site has htmx&amp;rsquo;s &lt;code&gt;hx-boost&lt;/code&gt; on the body: internal navigation swaps page content in place instead of doing full page loads, which keeps transitions smooth. Separately, the Blowfish theme is smart about heavy libraries: mermaid, KaTeX, and Chart.js bundles are only included on pages that use them, injected into the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; of exactly those pages.&lt;/p&gt;
&lt;p&gt;Each feature is sensible alone. Together they have a hole in the middle:&lt;/p&gt;
&lt;div class="not-prose diagram diagram-light"&gt;&lt;svg id="d4c0c6133c60e0204light" width="100%" xmlns="http://www.w3.org/2000/svg" class="flowchart" style="max-width: 2504.984375px;" viewBox="0 0 2504.984375 188" role="graphics-document document" aria-roledescription="flowchart-v2"&gt;&lt;style&gt;#d4c0c6133c60e0204light{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,noto sans,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#d4c0c6133c60e0204light .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#d4c0c6133c60e0204light .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#d4c0c6133c60e0204light .error-icon{fill:rgb(255, 255, 255);}#d4c0c6133c60e0204light .error-text{fill:#000000;stroke:#000000;}#d4c0c6133c60e0204light .edge-thickness-normal{stroke-width:1px;}#d4c0c6133c60e0204light .edge-thickness-thick{stroke-width:3.5px;}#d4c0c6133c60e0204light .edge-pattern-solid{stroke-dasharray:0;}#d4c0c6133c60e0204light .edge-thickness-invisible{stroke-width:0;fill:none;}#d4c0c6133c60e0204light .edge-pattern-dashed{stroke-dasharray:3;}#d4c0c6133c60e0204light .edge-pattern-dotted{stroke-dasharray:2;}#d4c0c6133c60e0204light .marker{fill:rgb(74, 86, 92);stroke:rgb(74, 86, 92);}#d4c0c6133c60e0204light .marker.cross{stroke:rgb(74, 86, 92);}#d4c0c6133c60e0204light svg{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,noto sans,sans-serif;font-size:16px;}#d4c0c6133c60e0204light p{margin:0;}#d4c0c6133c60e0204light .label{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,noto sans,sans-serif;color:#333;}#d4c0c6133c60e0204light .cluster-label text{fill:#000000;}#d4c0c6133c60e0204light .cluster-label span{color:#000000;}#d4c0c6133c60e0204light .cluster-label span p{background-color:transparent;}#d4c0c6133c60e0204light .label text,#d4c0c6133c60e0204light span{fill:#333;color:#333;}#d4c0c6133c60e0204light .node rect,#d4c0c6133c60e0204light .node circle,#d4c0c6133c60e0204light .node ellipse,#d4c0c6133c60e0204light .node polygon,#d4c0c6133c60e0204light .node path{fill:rgb(255, 255, 255);stroke:rgb(204, 216, 222);stroke-width:1px;}#d4c0c6133c60e0204light .rough-node .label text,#d4c0c6133c60e0204light .node .label text,#d4c0c6133c60e0204light .image-shape .label,#d4c0c6133c60e0204light .icon-shape .label{text-anchor:middle;}#d4c0c6133c60e0204light .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#d4c0c6133c60e0204light .rough-node .label,#d4c0c6133c60e0204light .node .label,#d4c0c6133c60e0204light .image-shape .label,#d4c0c6133c60e0204light .icon-shape .label{text-align:center;}#d4c0c6133c60e0204light .node.clickable{cursor:pointer;}#d4c0c6133c60e0204light .root .anchor path{fill:rgb(74, 86, 92)!important;stroke-width:0;stroke:rgb(74, 86, 92);}#d4c0c6133c60e0204light .arrowheadPath{fill:#000000;}#d4c0c6133c60e0204light .edgePath .path{stroke:rgb(74, 86, 92);stroke-width:1px;}#d4c0c6133c60e0204light .flowchart-link{stroke:rgb(74, 86, 92);fill:none;}#d4c0c6133c60e0204light .edgeLabel{background-color:rgb(182, 240, 255);text-align:center;}#d4c0c6133c60e0204light .edgeLabel p{background-color:rgb(182, 240, 255);}#d4c0c6133c60e0204light .edgeLabel rect{opacity:0.5;background-color:rgb(182, 240, 255);fill:rgb(182, 240, 255);}#d4c0c6133c60e0204light .labelBkg{background-color:rgba(182, 240, 255, 0.5);}#d4c0c6133c60e0204light .cluster rect{fill:rgb(255, 255, 255);stroke:rgb(129, 146, 154);stroke-width:1px;}#d4c0c6133c60e0204light .cluster text{fill:#000000;}#d4c0c6133c60e0204light .cluster span{color:#000000;}#d4c0c6133c60e0204light div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,noto sans,sans-serif;font-size:12px;background:rgb(255, 255, 255);border:1px solid rgb(129, 146, 154);border-radius:2px;pointer-events:none;z-index:100;}#d4c0c6133c60e0204light .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#d4c0c6133c60e0204light rect.text{fill:none;stroke-width:0;}#d4c0c6133c60e0204light .icon-shape,#d4c0c6133c60e0204light .image-shape{background-color:rgb(182, 240, 255);text-align:center;}#d4c0c6133c60e0204light .icon-shape p,#d4c0c6133c60e0204light .image-shape p{background-color:rgb(182, 240, 255);padding:2px;}#d4c0c6133c60e0204light .icon-shape .label rect,#d4c0c6133c60e0204light .image-shape .label rect{opacity:0.5;background-color:rgb(182, 240, 255);fill:rgb(182, 240, 255);}#d4c0c6133c60e0204light .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#d4c0c6133c60e0204light .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#d4c0c6133c60e0204light .node .neo-node{stroke:rgb(204, 216, 222);}#d4c0c6133c60e0204light [data-look="neo"].node rect,#d4c0c6133c60e0204light [data-look="neo"].cluster rect,#d4c0c6133c60e0204light [data-look="neo"].node polygon{stroke:url(#d4c0c6133c60e0204light-gradient);filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#d4c0c6133c60e0204light [data-look="neo"].swimlane.cluster rect{filter:none;}#d4c0c6133c60e0204light [data-look="neo"].node path{stroke:url(#d4c0c6133c60e0204light-gradient);stroke-width:1px;}#d4c0c6133c60e0204light [data-look="neo"].node .outer-path{filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#d4c0c6133c60e0204light [data-look="neo"].node .neo-line path{stroke:rgb(204, 216, 222);filter:none;}#d4c0c6133c60e0204light [data-look="neo"].node circle{stroke:url(#d4c0c6133c60e0204light-gradient);filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#d4c0c6133c60e0204light [data-look="neo"].node circle .state-start{fill:#000000;}#d4c0c6133c60e0204light [data-look="neo"].icon-shape .icon{fill:url(#d4c0c6133c60e0204light-gradient);filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#d4c0c6133c60e0204light [data-look="neo"].icon-shape .icon-neo path{stroke:url(#d4c0c6133c60e0204light-gradient);filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#d4c0c6133c60e0204light :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}&lt;/style&gt;&lt;g&gt;&lt;marker id="d4c0c6133c60e0204light_flowchart-v2-pointEnd" class="marker flowchart-v2" viewBox="0 0 10 10" refX="5" refY="5" markerUnits="userSpaceOnUse" markerWidth="8" markerHeight="8" orient="auto"&gt;&lt;path d="M 0 0 L 10 5 L 0 10 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"&gt;&lt;/path&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204light_flowchart-v2-pointStart" class="marker flowchart-v2" viewBox="0 0 10 10" refX="4.5" refY="5" markerUnits="userSpaceOnUse" markerWidth="8" markerHeight="8" orient="auto"&gt;&lt;path d="M 0 5 L 10 10 L 10 0 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"&gt;&lt;/path&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204light_flowchart-v2-pointEnd-margin" class="marker flowchart-v2" viewBox="0 0 11.5 14" refX="11.5" refY="7" markerUnits="userSpaceOnUse" markerWidth="10.5" markerHeight="14" orient="auto"&gt;&lt;path d="M 0 0 L 11.5 7 L 0 14 z" class="arrowMarkerPath" style="stroke-width: 0; stroke-dasharray: 1, 0;"&gt;&lt;/path&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204light_flowchart-v2-pointStart-margin" class="marker flowchart-v2" viewBox="0 0 11.5 14" refX="1" refY="7" markerUnits="userSpaceOnUse" markerWidth="11.5" markerHeight="14" orient="auto"&gt;&lt;polygon points="0,7 11.5,14 11.5,0" class="arrowMarkerPath" style="stroke-width: 0; stroke-dasharray: 1, 0;"&gt;&lt;/polygon&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204light_flowchart-v2-circleEnd" class="marker flowchart-v2" viewBox="0 0 10 10" refX="11" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"&gt;&lt;circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"&gt;&lt;/circle&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204light_flowchart-v2-circleStart" class="marker flowchart-v2" viewBox="0 0 10 10" refX="-1" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"&gt;&lt;circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"&gt;&lt;/circle&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204light_flowchart-v2-circleEnd-margin" class="marker flowchart-v2" viewBox="0 0 10 10" refY="5" refX="12.25" markerUnits="userSpaceOnUse" markerWidth="14" markerHeight="14" orient="auto"&gt;&lt;circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 0; stroke-dasharray: 1, 0;"&gt;&lt;/circle&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204light_flowchart-v2-circleStart-margin" class="marker flowchart-v2" viewBox="0 0 10 10" refX="-2" refY="5" markerUnits="userSpaceOnUse" markerWidth="14" markerHeight="14" orient="auto"&gt;&lt;circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 0; stroke-dasharray: 1, 0;"&gt;&lt;/circle&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204light_flowchart-v2-crossEnd" class="marker cross flowchart-v2" viewBox="0 0 11 11" refX="12" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"&gt;&lt;path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"&gt;&lt;/path&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204light_flowchart-v2-crossStart" class="marker cross flowchart-v2" viewBox="0 0 11 11" refX="-1" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"&gt;&lt;path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"&gt;&lt;/path&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204light_flowchart-v2-crossEnd-margin" class="marker cross flowchart-v2" viewBox="0 0 15 15" refX="17.7" refY="7.5" markerUnits="userSpaceOnUse" markerWidth="12" markerHeight="12" orient="auto"&gt;&lt;path d="M 1,1 L 14,14 M 1,14 L 14,1" class="arrowMarkerPath" style="stroke-width: 2.5;"&gt;&lt;/path&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204light_flowchart-v2-crossStart-margin" class="marker cross flowchart-v2" viewBox="0 0 15 15" refX="-3.5" refY="7.5" markerUnits="userSpaceOnUse" markerWidth="12" markerHeight="12" orient="auto"&gt;&lt;path d="M 1,1 L 14,14 M 1,14 L 14,1" class="arrowMarkerPath" style="stroke-width: 2.5; stroke-dasharray: 1, 0;"&gt;&lt;/path&gt;&lt;/marker&gt;&lt;g class="root"&gt;&lt;g class="clusters"&gt;&lt;/g&gt;&lt;g class="edgePaths"&gt;&lt;/g&gt;&lt;g class="edgeLabels"&gt;&lt;/g&gt;&lt;g class="nodes"&gt;&lt;g class="root" transform="translate(0, 0)"&gt;&lt;g class="clusters"&gt;&lt;g class="cluster" id="d4c0c6133c60e0204light-N" data-look="classic"&gt;&lt;rect style="" x="8" y="8" width="1569.375" height="172"&gt;&lt;/rect&gt;&lt;g class="cluster-label" transform="translate(720.65625, 8)"&gt;&lt;foreignObject width="144.0625" height="24"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table-cell; white-space: nowrap; line-height: 1.5;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;hx-boost navigation&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="edgePaths"&gt;&lt;path d="M302.109,94L308.359,94C314.609,94,327.109,94,338.943,94C350.776,94,361.943,94,367.526,94L373.109,94" id="d4c0c6133c60e0204light-L_D_E_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_D_E_0" data-points="W3sieCI6MzAyLjEwOTM3NSwieSI6OTR9LHsieCI6MzM5LjYwOTM3NSwieSI6OTR9LHsieCI6Mzc3LjEwOTM3NSwieSI6OTR9XQ==" data-look="classic" marker-end="url(#d4c0c6133c60e0204light_flowchart-v2-pointEnd)"&gt;&lt;/path&gt;&lt;path d="M592.25,94L598.5,94C604.75,94,617.25,94,629.083,94C640.917,94,652.083,94,657.667,94L663.25,94" id="d4c0c6133c60e0204light-L_E_F_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_E_F_0" data-points="W3sieCI6NTkyLjI1LCJ5Ijo5NH0seyJ4Ijo2MjkuNzUsInkiOjk0fSx7IngiOjY2Ny4yNSwieSI6OTR9XQ==" data-look="classic" marker-end="url(#d4c0c6133c60e0204light_flowchart-v2-pointEnd)"&gt;&lt;/path&gt;&lt;path d="M927.25,94L933.5,94C939.75,94,952.25,94,964.083,94C975.917,94,987.083,94,992.667,94L998.25,94" id="d4c0c6133c60e0204light-L_F_G_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_F_G_0" data-points="W3sieCI6OTI3LjI1LCJ5Ijo5NH0seyJ4Ijo5NjQuNzUsInkiOjk0fSx7IngiOjEwMDIuMjUsInkiOjk0fV0=" data-look="classic" marker-end="url(#d4c0c6133c60e0204light_flowchart-v2-pointEnd)"&gt;&lt;/path&gt;&lt;path d="M1262.25,94L1268.5,94C1274.75,94,1287.25,94,1299.083,94C1310.917,94,1322.083,94,1327.667,94L1333.25,94" id="d4c0c6133c60e0204light-L_G_H_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_G_H_0" data-points="W3sieCI6MTI2Mi4yNSwieSI6OTR9LHsieCI6MTI5OS43NSwieSI6OTR9LHsieCI6MTMzNy4yNSwieSI6OTR9XQ==" data-look="classic" marker-end="url(#d4c0c6133c60e0204light_flowchart-v2-pointEnd)"&gt;&lt;/path&gt;&lt;/g&gt;&lt;g class="edgeLabels"&gt;&lt;g class="edgeLabel"&gt;&lt;g class="label" data-id="L_D_E_0" transform="translate(0, 0)"&gt;&lt;foreignObject width="0" height="0"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="edgeLabel"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="edgeLabel"&gt;&lt;g class="label" data-id="L_E_F_0" transform="translate(0, 0)"&gt;&lt;foreignObject width="0" height="0"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="edgeLabel"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="edgeLabel"&gt;&lt;g class="label" data-id="L_F_G_0" transform="translate(0, 0)"&gt;&lt;foreignObject width="0" height="0"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="edgeLabel"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="edgeLabel"&gt;&lt;g class="label" data-id="L_G_H_0" transform="translate(0, 0)"&gt;&lt;foreignObject width="0" height="0"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="edgeLabel"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="nodes"&gt;&lt;g class="node default" id="d4c0c6133c60e0204light-flowchart-D-3" data-look="classic" transform="translate(173.8046875, 94)"&gt;&lt;rect class="basic label-container" style="" x="-128.3046875" y="-27" width="256.609375" height="54"&gt;&lt;/rect&gt;&lt;g class="label" style="" transform="translate(-98.3046875, -12)"&gt;&lt;rect&gt;&lt;/rect&gt;&lt;foreignObject width="196.609375" height="24"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;htmx fetches the new page&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="node default" id="d4c0c6133c60e0204light-flowchart-E-4" data-look="classic" transform="translate(484.6796875, 94)"&gt;&lt;rect class="basic label-container" style="" x="-107.5703125" y="-27" width="215.140625" height="54"&gt;&lt;/rect&gt;&lt;g class="label" style="" transform="translate(-77.5703125, -12)"&gt;&lt;rect&gt;&lt;/rect&gt;&lt;foreignObject width="155.140625" height="24"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;swaps the BODY only&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="node default" id="d4c0c6133c60e0204light-flowchart-F-6" data-look="classic" transform="translate(797.25, 94)"&gt;&lt;rect class="basic label-container" style="" x="-130" y="-51" width="260" height="102"&gt;&lt;/rect&gt;&lt;g class="label" style="" transform="translate(-100, -36)"&gt;&lt;rect&gt;&lt;/rect&gt;&lt;foreignObject width="200" height="72"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table; white-space: break-spaces; line-height: 1.5; max-width: 200px; text-align: center; width: 200px;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;the new head, and its&lt;br&gt;bundle script, never execute&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="node default" id="d4c0c6133c60e0204light-flowchart-G-8" data-look="classic" transform="translate(1132.25, 94)"&gt;&lt;rect class="basic label-container" style="" x="-130" y="-51" width="260" height="102"&gt;&lt;/rect&gt;&lt;g class="label" style="" transform="translate(-100, -36)"&gt;&lt;rect&gt;&lt;/rect&gt;&lt;foreignObject width="200" height="72"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table; white-space: break-spaces; line-height: 1.5; max-width: 200px; text-align: center; width: 200px;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;typeof mermaid is undefined,&lt;br&gt;re-init guard silently skips&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="node default" id="d4c0c6133c60e0204light-flowchart-H-10" data-look="classic" transform="translate(1438.5625, 94)"&gt;&lt;rect class="basic label-container" style="" x="-101.3125" y="-39" width="202.625" height="78"&gt;&lt;/rect&gt;&lt;g class="label" style="" transform="translate(-71.3125, -24)"&gt;&lt;rect&gt;&lt;/rect&gt;&lt;foreignObject width="142.625" height="48"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;raw diagram source&lt;br&gt;on the page&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="root" transform="translate(1619.375, 12)"&gt;&lt;g class="clusters"&gt;&lt;g class="cluster" id="d4c0c6133c60e0204light-L" data-look="classic"&gt;&lt;rect style="" x="8" y="8" width="869.609375" height="148"&gt;&lt;/rect&gt;&lt;g class="cluster-label" transform="translate(372.1796875, 8)"&gt;&lt;foreignObject width="141.25" height="24"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table-cell; white-space: nowrap; line-height: 1.5;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;direct load / refresh&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="edgePaths"&gt;&lt;path d="M290.828,82L297.078,82C303.328,82,315.828,82,327.661,82C339.495,82,350.661,82,356.245,82L361.828,82" id="d4c0c6133c60e0204light-L_A_B_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_A_B_0" data-points="W3sieCI6MjkwLjgyODEyNSwieSI6ODJ9LHsieCI6MzI4LjMyODEyNSwieSI6ODJ9LHsieCI6MzY1LjgyODEyNSwieSI6ODJ9XQ==" data-look="classic" marker-end="url(#d4c0c6133c60e0204light_flowchart-v2-pointEnd)"&gt;&lt;/path&gt;&lt;path d="M586.469,82L592.719,82C598.969,82,611.469,82,623.302,82C635.135,82,646.302,82,651.885,82L657.469,82" id="d4c0c6133c60e0204light-L_B_C_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_B_C_0" data-points="W3sieCI6NTg2LjQ2ODc1LCJ5Ijo4Mn0seyJ4Ijo2MjMuOTY4NzUsInkiOjgyfSx7IngiOjY2MS40Njg3NSwieSI6ODJ9XQ==" data-look="classic" marker-end="url(#d4c0c6133c60e0204light_flowchart-v2-pointEnd)"&gt;&lt;/path&gt;&lt;/g&gt;&lt;g class="edgeLabels"&gt;&lt;g class="edgeLabel"&gt;&lt;g class="label" data-id="L_A_B_0" transform="translate(0, 0)"&gt;&lt;foreignObject width="0" height="0"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="edgeLabel"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="edgeLabel"&gt;&lt;g class="label" data-id="L_B_C_0" transform="translate(0, 0)"&gt;&lt;foreignObject width="0" height="0"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="edgeLabel"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="nodes"&gt;&lt;g class="node default" id="d4c0c6133c60e0204light-flowchart-A-0" data-look="classic" transform="translate(168.1640625, 82)"&gt;&lt;rect class="basic label-container" style="" x="-122.6640625" y="-27" width="245.328125" height="54"&gt;&lt;/rect&gt;&lt;g class="label" style="" transform="translate(-92.6640625, -12)"&gt;&lt;rect&gt;&lt;/rect&gt;&lt;foreignObject width="185.328125" height="24"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;browser parses full HTML&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="node default" id="d4c0c6133c60e0204light-flowchart-B-1" data-look="classic" transform="translate(476.1484375, 82)"&gt;&lt;rect class="basic label-container" style="" x="-110.3203125" y="-39" width="220.640625" height="78"&gt;&lt;/rect&gt;&lt;g class="label" style="" transform="translate(-80.3203125, -24)"&gt;&lt;rect&gt;&lt;/rect&gt;&lt;foreignObject width="160.640625" height="48"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;head scripts execute,&lt;br&gt;mermaid bundle loads&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="node default" id="d4c0c6133c60e0204light-flowchart-C-2" data-look="classic" transform="translate(750.7890625, 82)"&gt;&lt;rect class="basic label-container" style="" x="-89.3203125" y="-27" width="178.640625" height="54"&gt;&lt;/rect&gt;&lt;g class="label" style="" transform="translate(-59.3203125, -12)"&gt;&lt;rect&gt;&lt;/rect&gt;&lt;foreignObject width="118.640625" height="24"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;diagram renders&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs&gt;&lt;filter id="d4c0c6133c60e0204light-drop-shadow" height="130%" width="130%"&gt;&lt;feDropShadow dx="4" dy="4" stdDeviation="0" flood-opacity="0.06" flood-color="#000000"&gt;&lt;/feDropShadow&gt;&lt;/filter&gt;&lt;/defs&gt;&lt;defs&gt;&lt;filter id="d4c0c6133c60e0204light-drop-shadow-small" height="150%" width="150%"&gt;&lt;feDropShadow dx="2" dy="2" stdDeviation="0" flood-opacity="0.06" flood-color="#000000"&gt;&lt;/feDropShadow&gt;&lt;/filter&gt;&lt;/defs&gt;&lt;linearGradient id="d4c0c6133c60e0204light-gradient" gradientUnits="objectBoundingBox" x1="0%" y1="0%" x2="100%" y2="0%"&gt;&lt;stop offset="0%" stop-color="rgb(204, 216, 222)" stop-opacity="1"&gt;&lt;/stop&gt;&lt;stop offset="100%" stop-color="rgb(28, 209, 255)" stop-opacity="1"&gt;&lt;/stop&gt;&lt;/linearGradient&gt;&lt;/svg&gt;&lt;/div&gt;
 &lt;div class="not-prose diagram diagram-dark"&gt;&lt;svg id="d4c0c6133c60e0204dark" width="100%" xmlns="http://www.w3.org/2000/svg" class="flowchart" style="max-width: 2504.984375px;" viewBox="0 0 2504.984375 188" role="graphics-document document" aria-roledescription="flowchart-v2"&gt;&lt;style&gt;#d4c0c6133c60e0204dark{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,noto sans,sans-serif;font-size:16px;fill:#ccc;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#d4c0c6133c60e0204dark .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#d4c0c6133c60e0204dark .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#d4c0c6133c60e0204dark .error-icon{fill:#a44141;}#d4c0c6133c60e0204dark .error-text{fill:#ddd;stroke:#ddd;}#d4c0c6133c60e0204dark .edge-thickness-normal{stroke-width:1px;}#d4c0c6133c60e0204dark .edge-thickness-thick{stroke-width:3.5px;}#d4c0c6133c60e0204dark .edge-pattern-solid{stroke-dasharray:0;}#d4c0c6133c60e0204dark .edge-thickness-invisible{stroke-width:0;fill:none;}#d4c0c6133c60e0204dark .edge-pattern-dashed{stroke-dasharray:3;}#d4c0c6133c60e0204dark .edge-pattern-dotted{stroke-dasharray:2;}#d4c0c6133c60e0204dark .marker{fill:lightgrey;stroke:lightgrey;}#d4c0c6133c60e0204dark .marker.cross{stroke:lightgrey;}#d4c0c6133c60e0204dark svg{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,noto sans,sans-serif;font-size:16px;}#d4c0c6133c60e0204dark p{margin:0;}#d4c0c6133c60e0204dark .label{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,noto sans,sans-serif;color:#ccc;}#d4c0c6133c60e0204dark .cluster-label text{fill:#F9FFFE;}#d4c0c6133c60e0204dark .cluster-label span{color:#F9FFFE;}#d4c0c6133c60e0204dark .cluster-label span p{background-color:transparent;}#d4c0c6133c60e0204dark .label text,#d4c0c6133c60e0204dark span{fill:#ccc;color:#ccc;}#d4c0c6133c60e0204dark .node rect,#d4c0c6133c60e0204dark .node circle,#d4c0c6133c60e0204dark .node ellipse,#d4c0c6133c60e0204dark .node polygon,#d4c0c6133c60e0204dark .node path{fill:#1f2020;stroke:#ccc;stroke-width:1px;}#d4c0c6133c60e0204dark .rough-node .label text,#d4c0c6133c60e0204dark .node .label text,#d4c0c6133c60e0204dark .image-shape .label,#d4c0c6133c60e0204dark .icon-shape .label{text-anchor:middle;}#d4c0c6133c60e0204dark .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#d4c0c6133c60e0204dark .rough-node .label,#d4c0c6133c60e0204dark .node .label,#d4c0c6133c60e0204dark .image-shape .label,#d4c0c6133c60e0204dark .icon-shape .label{text-align:center;}#d4c0c6133c60e0204dark .node.clickable{cursor:pointer;}#d4c0c6133c60e0204dark .root .anchor path{fill:lightgrey!important;stroke-width:0;stroke:lightgrey;}#d4c0c6133c60e0204dark .arrowheadPath{fill:lightgrey;}#d4c0c6133c60e0204dark .edgePath .path{stroke:lightgrey;stroke-width:1px;}#d4c0c6133c60e0204dark .flowchart-link{stroke:lightgrey;fill:none;}#d4c0c6133c60e0204dark .edgeLabel{background-color:hsl(0, 0%, 34.4117647059%);text-align:center;}#d4c0c6133c60e0204dark .edgeLabel p{background-color:hsl(0, 0%, 34.4117647059%);}#d4c0c6133c60e0204dark .edgeLabel rect{opacity:0.5;background-color:hsl(0, 0%, 34.4117647059%);fill:hsl(0, 0%, 34.4117647059%);}#d4c0c6133c60e0204dark .labelBkg{background-color:rgba(87.75, 87.75, 87.75, 0.5);}#d4c0c6133c60e0204dark .cluster rect{fill:hsl(180, 1.5873015873%, 28.3529411765%);stroke:rgba(255, 255, 255, 0.25);stroke-width:1px;}#d4c0c6133c60e0204dark .cluster text{fill:#F9FFFE;}#d4c0c6133c60e0204dark .cluster span{color:#F9FFFE;}#d4c0c6133c60e0204dark div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,noto sans,sans-serif;font-size:12px;background:hsl(20, 1.5873015873%, 12.3529411765%);border:1px solid rgba(255, 255, 255, 0.25);border-radius:2px;pointer-events:none;z-index:100;}#d4c0c6133c60e0204dark .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#ccc;}#d4c0c6133c60e0204dark rect.text{fill:none;stroke-width:0;}#d4c0c6133c60e0204dark .icon-shape,#d4c0c6133c60e0204dark .image-shape{background-color:hsl(0, 0%, 34.4117647059%);text-align:center;}#d4c0c6133c60e0204dark .icon-shape p,#d4c0c6133c60e0204dark .image-shape p{background-color:hsl(0, 0%, 34.4117647059%);padding:2px;}#d4c0c6133c60e0204dark .icon-shape .label rect,#d4c0c6133c60e0204dark .image-shape .label rect{opacity:0.5;background-color:hsl(0, 0%, 34.4117647059%);fill:hsl(0, 0%, 34.4117647059%);}#d4c0c6133c60e0204dark .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#d4c0c6133c60e0204dark .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#d4c0c6133c60e0204dark .node .neo-node{stroke:#ccc;}#d4c0c6133c60e0204dark [data-look="neo"].node rect,#d4c0c6133c60e0204dark [data-look="neo"].cluster rect,#d4c0c6133c60e0204dark [data-look="neo"].node polygon{stroke:url(#d4c0c6133c60e0204dark-gradient);filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#d4c0c6133c60e0204dark [data-look="neo"].swimlane.cluster rect{filter:none;}#d4c0c6133c60e0204dark [data-look="neo"].node path{stroke:url(#d4c0c6133c60e0204dark-gradient);stroke-width:1px;}#d4c0c6133c60e0204dark [data-look="neo"].node .outer-path{filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#d4c0c6133c60e0204dark [data-look="neo"].node .neo-line path{stroke:#ccc;filter:none;}#d4c0c6133c60e0204dark [data-look="neo"].node circle{stroke:url(#d4c0c6133c60e0204dark-gradient);filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#d4c0c6133c60e0204dark [data-look="neo"].node circle .state-start{fill:#000000;}#d4c0c6133c60e0204dark [data-look="neo"].icon-shape .icon{fill:url(#d4c0c6133c60e0204dark-gradient);filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#d4c0c6133c60e0204dark [data-look="neo"].icon-shape .icon-neo path{stroke:url(#d4c0c6133c60e0204dark-gradient);filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#d4c0c6133c60e0204dark :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}&lt;/style&gt;&lt;g&gt;&lt;marker id="d4c0c6133c60e0204dark_flowchart-v2-pointEnd" class="marker flowchart-v2" viewBox="0 0 10 10" refX="5" refY="5" markerUnits="userSpaceOnUse" markerWidth="8" markerHeight="8" orient="auto"&gt;&lt;path d="M 0 0 L 10 5 L 0 10 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"&gt;&lt;/path&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204dark_flowchart-v2-pointStart" class="marker flowchart-v2" viewBox="0 0 10 10" refX="4.5" refY="5" markerUnits="userSpaceOnUse" markerWidth="8" markerHeight="8" orient="auto"&gt;&lt;path d="M 0 5 L 10 10 L 10 0 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"&gt;&lt;/path&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204dark_flowchart-v2-pointEnd-margin" class="marker flowchart-v2" viewBox="0 0 11.5 14" refX="11.5" refY="7" markerUnits="userSpaceOnUse" markerWidth="10.5" markerHeight="14" orient="auto"&gt;&lt;path d="M 0 0 L 11.5 7 L 0 14 z" class="arrowMarkerPath" style="stroke-width: 0; stroke-dasharray: 1, 0;"&gt;&lt;/path&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204dark_flowchart-v2-pointStart-margin" class="marker flowchart-v2" viewBox="0 0 11.5 14" refX="1" refY="7" markerUnits="userSpaceOnUse" markerWidth="11.5" markerHeight="14" orient="auto"&gt;&lt;polygon points="0,7 11.5,14 11.5,0" class="arrowMarkerPath" style="stroke-width: 0; stroke-dasharray: 1, 0;"&gt;&lt;/polygon&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204dark_flowchart-v2-circleEnd" class="marker flowchart-v2" viewBox="0 0 10 10" refX="11" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"&gt;&lt;circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"&gt;&lt;/circle&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204dark_flowchart-v2-circleStart" class="marker flowchart-v2" viewBox="0 0 10 10" refX="-1" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"&gt;&lt;circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"&gt;&lt;/circle&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204dark_flowchart-v2-circleEnd-margin" class="marker flowchart-v2" viewBox="0 0 10 10" refY="5" refX="12.25" markerUnits="userSpaceOnUse" markerWidth="14" markerHeight="14" orient="auto"&gt;&lt;circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 0; stroke-dasharray: 1, 0;"&gt;&lt;/circle&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204dark_flowchart-v2-circleStart-margin" class="marker flowchart-v2" viewBox="0 0 10 10" refX="-2" refY="5" markerUnits="userSpaceOnUse" markerWidth="14" markerHeight="14" orient="auto"&gt;&lt;circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 0; stroke-dasharray: 1, 0;"&gt;&lt;/circle&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204dark_flowchart-v2-crossEnd" class="marker cross flowchart-v2" viewBox="0 0 11 11" refX="12" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"&gt;&lt;path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"&gt;&lt;/path&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204dark_flowchart-v2-crossStart" class="marker cross flowchart-v2" viewBox="0 0 11 11" refX="-1" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"&gt;&lt;path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"&gt;&lt;/path&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204dark_flowchart-v2-crossEnd-margin" class="marker cross flowchart-v2" viewBox="0 0 15 15" refX="17.7" refY="7.5" markerUnits="userSpaceOnUse" markerWidth="12" markerHeight="12" orient="auto"&gt;&lt;path d="M 1,1 L 14,14 M 1,14 L 14,1" class="arrowMarkerPath" style="stroke-width: 2.5;"&gt;&lt;/path&gt;&lt;/marker&gt;&lt;marker id="d4c0c6133c60e0204dark_flowchart-v2-crossStart-margin" class="marker cross flowchart-v2" viewBox="0 0 15 15" refX="-3.5" refY="7.5" markerUnits="userSpaceOnUse" markerWidth="12" markerHeight="12" orient="auto"&gt;&lt;path d="M 1,1 L 14,14 M 1,14 L 14,1" class="arrowMarkerPath" style="stroke-width: 2.5; stroke-dasharray: 1, 0;"&gt;&lt;/path&gt;&lt;/marker&gt;&lt;g class="root"&gt;&lt;g class="clusters"&gt;&lt;/g&gt;&lt;g class="edgePaths"&gt;&lt;/g&gt;&lt;g class="edgeLabels"&gt;&lt;/g&gt;&lt;g class="nodes"&gt;&lt;g class="root" transform="translate(0, 0)"&gt;&lt;g class="clusters"&gt;&lt;g class="cluster" id="d4c0c6133c60e0204dark-N" data-look="classic"&gt;&lt;rect style="" x="8" y="8" width="1569.375" height="172"&gt;&lt;/rect&gt;&lt;g class="cluster-label" transform="translate(720.65625, 8)"&gt;&lt;foreignObject width="144.0625" height="24"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table-cell; white-space: nowrap; line-height: 1.5;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;hx-boost navigation&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="edgePaths"&gt;&lt;path d="M302.109,94L308.359,94C314.609,94,327.109,94,338.943,94C350.776,94,361.943,94,367.526,94L373.109,94" id="d4c0c6133c60e0204dark-L_D_E_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_D_E_0" data-points="W3sieCI6MzAyLjEwOTM3NSwieSI6OTR9LHsieCI6MzM5LjYwOTM3NSwieSI6OTR9LHsieCI6Mzc3LjEwOTM3NSwieSI6OTR9XQ==" data-look="classic" marker-end="url(#d4c0c6133c60e0204dark_flowchart-v2-pointEnd)"&gt;&lt;/path&gt;&lt;path d="M592.25,94L598.5,94C604.75,94,617.25,94,629.083,94C640.917,94,652.083,94,657.667,94L663.25,94" id="d4c0c6133c60e0204dark-L_E_F_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_E_F_0" data-points="W3sieCI6NTkyLjI1LCJ5Ijo5NH0seyJ4Ijo2MjkuNzUsInkiOjk0fSx7IngiOjY2Ny4yNSwieSI6OTR9XQ==" data-look="classic" marker-end="url(#d4c0c6133c60e0204dark_flowchart-v2-pointEnd)"&gt;&lt;/path&gt;&lt;path d="M927.25,94L933.5,94C939.75,94,952.25,94,964.083,94C975.917,94,987.083,94,992.667,94L998.25,94" id="d4c0c6133c60e0204dark-L_F_G_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_F_G_0" data-points="W3sieCI6OTI3LjI1LCJ5Ijo5NH0seyJ4Ijo5NjQuNzUsInkiOjk0fSx7IngiOjEwMDIuMjUsInkiOjk0fV0=" data-look="classic" marker-end="url(#d4c0c6133c60e0204dark_flowchart-v2-pointEnd)"&gt;&lt;/path&gt;&lt;path d="M1262.25,94L1268.5,94C1274.75,94,1287.25,94,1299.083,94C1310.917,94,1322.083,94,1327.667,94L1333.25,94" id="d4c0c6133c60e0204dark-L_G_H_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_G_H_0" data-points="W3sieCI6MTI2Mi4yNSwieSI6OTR9LHsieCI6MTI5OS43NSwieSI6OTR9LHsieCI6MTMzNy4yNSwieSI6OTR9XQ==" data-look="classic" marker-end="url(#d4c0c6133c60e0204dark_flowchart-v2-pointEnd)"&gt;&lt;/path&gt;&lt;/g&gt;&lt;g class="edgeLabels"&gt;&lt;g class="edgeLabel"&gt;&lt;g class="label" data-id="L_D_E_0" transform="translate(0, 0)"&gt;&lt;foreignObject width="0" height="0"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="edgeLabel"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="edgeLabel"&gt;&lt;g class="label" data-id="L_E_F_0" transform="translate(0, 0)"&gt;&lt;foreignObject width="0" height="0"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="edgeLabel"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="edgeLabel"&gt;&lt;g class="label" data-id="L_F_G_0" transform="translate(0, 0)"&gt;&lt;foreignObject width="0" height="0"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="edgeLabel"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="edgeLabel"&gt;&lt;g class="label" data-id="L_G_H_0" transform="translate(0, 0)"&gt;&lt;foreignObject width="0" height="0"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="edgeLabel"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="nodes"&gt;&lt;g class="node default" id="d4c0c6133c60e0204dark-flowchart-D-3" data-look="classic" transform="translate(173.8046875, 94)"&gt;&lt;rect class="basic label-container" style="" x="-128.3046875" y="-27" width="256.609375" height="54"&gt;&lt;/rect&gt;&lt;g class="label" style="" transform="translate(-98.3046875, -12)"&gt;&lt;rect&gt;&lt;/rect&gt;&lt;foreignObject width="196.609375" height="24"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;htmx fetches the new page&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="node default" id="d4c0c6133c60e0204dark-flowchart-E-4" data-look="classic" transform="translate(484.6796875, 94)"&gt;&lt;rect class="basic label-container" style="" x="-107.5703125" y="-27" width="215.140625" height="54"&gt;&lt;/rect&gt;&lt;g class="label" style="" transform="translate(-77.5703125, -12)"&gt;&lt;rect&gt;&lt;/rect&gt;&lt;foreignObject width="155.140625" height="24"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;swaps the BODY only&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="node default" id="d4c0c6133c60e0204dark-flowchart-F-6" data-look="classic" transform="translate(797.25, 94)"&gt;&lt;rect class="basic label-container" style="" x="-130" y="-51" width="260" height="102"&gt;&lt;/rect&gt;&lt;g class="label" style="" transform="translate(-100, -36)"&gt;&lt;rect&gt;&lt;/rect&gt;&lt;foreignObject width="200" height="72"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table; white-space: break-spaces; line-height: 1.5; max-width: 200px; text-align: center; width: 200px;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;the new head, and its&lt;br&gt;bundle script, never execute&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="node default" id="d4c0c6133c60e0204dark-flowchart-G-8" data-look="classic" transform="translate(1132.25, 94)"&gt;&lt;rect class="basic label-container" style="" x="-130" y="-51" width="260" height="102"&gt;&lt;/rect&gt;&lt;g class="label" style="" transform="translate(-100, -36)"&gt;&lt;rect&gt;&lt;/rect&gt;&lt;foreignObject width="200" height="72"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table; white-space: break-spaces; line-height: 1.5; max-width: 200px; text-align: center; width: 200px;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;typeof mermaid is undefined,&lt;br&gt;re-init guard silently skips&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="node default" id="d4c0c6133c60e0204dark-flowchart-H-10" data-look="classic" transform="translate(1438.5625, 94)"&gt;&lt;rect class="basic label-container" style="" x="-101.3125" y="-39" width="202.625" height="78"&gt;&lt;/rect&gt;&lt;g class="label" style="" transform="translate(-71.3125, -24)"&gt;&lt;rect&gt;&lt;/rect&gt;&lt;foreignObject width="142.625" height="48"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;raw diagram source&lt;br&gt;on the page&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="root" transform="translate(1619.375, 12)"&gt;&lt;g class="clusters"&gt;&lt;g class="cluster" id="d4c0c6133c60e0204dark-L" data-look="classic"&gt;&lt;rect style="" x="8" y="8" width="869.609375" height="148"&gt;&lt;/rect&gt;&lt;g class="cluster-label" transform="translate(372.1796875, 8)"&gt;&lt;foreignObject width="141.25" height="24"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table-cell; white-space: nowrap; line-height: 1.5;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;direct load / refresh&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="edgePaths"&gt;&lt;path d="M290.828,82L297.078,82C303.328,82,315.828,82,327.661,82C339.495,82,350.661,82,356.245,82L361.828,82" id="d4c0c6133c60e0204dark-L_A_B_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_A_B_0" data-points="W3sieCI6MjkwLjgyODEyNSwieSI6ODJ9LHsieCI6MzI4LjMyODEyNSwieSI6ODJ9LHsieCI6MzY1LjgyODEyNSwieSI6ODJ9XQ==" data-look="classic" marker-end="url(#d4c0c6133c60e0204dark_flowchart-v2-pointEnd)"&gt;&lt;/path&gt;&lt;path d="M586.469,82L592.719,82C598.969,82,611.469,82,623.302,82C635.135,82,646.302,82,651.885,82L657.469,82" id="d4c0c6133c60e0204dark-L_B_C_0" class="edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link" style=";" data-edge="true" data-et="edge" data-id="L_B_C_0" data-points="W3sieCI6NTg2LjQ2ODc1LCJ5Ijo4Mn0seyJ4Ijo2MjMuOTY4NzUsInkiOjgyfSx7IngiOjY2MS40Njg3NSwieSI6ODJ9XQ==" data-look="classic" marker-end="url(#d4c0c6133c60e0204dark_flowchart-v2-pointEnd)"&gt;&lt;/path&gt;&lt;/g&gt;&lt;g class="edgeLabels"&gt;&lt;g class="edgeLabel"&gt;&lt;g class="label" data-id="L_A_B_0" transform="translate(0, 0)"&gt;&lt;foreignObject width="0" height="0"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="edgeLabel"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="edgeLabel"&gt;&lt;g class="label" data-id="L_B_C_0" transform="translate(0, 0)"&gt;&lt;foreignObject width="0" height="0"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" class="labelBkg" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="edgeLabel"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="nodes"&gt;&lt;g class="node default" id="d4c0c6133c60e0204dark-flowchart-A-0" data-look="classic" transform="translate(168.1640625, 82)"&gt;&lt;rect class="basic label-container" style="" x="-122.6640625" y="-27" width="245.328125" height="54"&gt;&lt;/rect&gt;&lt;g class="label" style="" transform="translate(-92.6640625, -12)"&gt;&lt;rect&gt;&lt;/rect&gt;&lt;foreignObject width="185.328125" height="24"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;browser parses full HTML&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="node default" id="d4c0c6133c60e0204dark-flowchart-B-1" data-look="classic" transform="translate(476.1484375, 82)"&gt;&lt;rect class="basic label-container" style="" x="-110.3203125" y="-39" width="220.640625" height="78"&gt;&lt;/rect&gt;&lt;g class="label" style="" transform="translate(-80.3203125, -24)"&gt;&lt;rect&gt;&lt;/rect&gt;&lt;foreignObject width="160.640625" height="48"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;head scripts execute,&lt;br&gt;mermaid bundle loads&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class="node default" id="d4c0c6133c60e0204dark-flowchart-C-2" data-look="classic" transform="translate(750.7890625, 82)"&gt;&lt;rect class="basic label-container" style="" x="-89.3203125" y="-27" width="178.640625" height="54"&gt;&lt;/rect&gt;&lt;g class="label" style="" transform="translate(-59.3203125, -12)"&gt;&lt;rect&gt;&lt;/rect&gt;&lt;foreignObject width="118.640625" height="24"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;"&gt;&lt;span class="nodeLabel"&gt;&lt;p&gt;diagram renders&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs&gt;&lt;filter id="d4c0c6133c60e0204dark-drop-shadow" height="130%" width="130%"&gt;&lt;feDropShadow dx="4" dy="4" stdDeviation="0" flood-opacity="0.06" flood-color="#FFFFFF"&gt;&lt;/feDropShadow&gt;&lt;/filter&gt;&lt;/defs&gt;&lt;defs&gt;&lt;filter id="d4c0c6133c60e0204dark-drop-shadow-small" height="150%" width="150%"&gt;&lt;feDropShadow dx="2" dy="2" stdDeviation="0" flood-opacity="0.06" flood-color="#FFFFFF"&gt;&lt;/feDropShadow&gt;&lt;/filter&gt;&lt;/defs&gt;&lt;linearGradient id="d4c0c6133c60e0204dark-gradient" gradientUnits="objectBoundingBox" x1="0%" y1="0%" x2="100%" y2="0%"&gt;&lt;stop offset="0%" stop-color="#cccccc" stop-opacity="1"&gt;&lt;/stop&gt;&lt;stop offset="100%" stop-color="hsl(180, 0%, 18.3529411765%)" stop-opacity="1"&gt;&lt;/stop&gt;&lt;/linearGradient&gt;&lt;/svg&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;hx-boost&lt;/code&gt; &lt;a href="https://htmx.org/attributes/hx-boost/" target="_blank" rel="noreferrer"&gt;replaces the body and updates the title&lt;/a&gt;; it does not merge the incoming head. So when you navigate from a page without diagrams to a page with them, the one script tag that would have loaded the mermaid bundle is in the part of the document that gets thrown away. My re-render code even had a guard, &lt;code&gt;if (typeof mermaid !== 'undefined')&lt;/code&gt;, which is exactly the kind of guard that turns a loud failure into a silent one. It skipped, politely, every time.&lt;/p&gt;
&lt;p&gt;Direct loads worked because the full document parses normally. Which is why months of my own testing missed it: I test pages by URL. Readers arrive by link.&lt;/p&gt;

&lt;h2 class="relative group"&gt;The fix: steal the bundle URL from the response you already have
 &lt;div id="the-fix-steal-the-bundle-url-from-the-response-you-already-have" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-fix-steal-the-bundle-url-from-the-response-you-already-have" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;The swapped-in page&amp;rsquo;s HTML passes through htmx&amp;rsquo;s hands, head included, before the body is extracted. The fix reads the bundle URL out of that response and injects the script once:&lt;/p&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-js" data-lang="js"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;ensureVendorThenRender&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;evt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;srcPattern&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;isReady&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isReady&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;xhr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;evt&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;evt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;detail&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;evt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;detail&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;html&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;xhr&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;responseText&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;match&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;html&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;html&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;srcPattern&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;match&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;injectedVendors&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]])&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nx"&gt;injectedVendors&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;script&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;src&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;appendChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Called from the &lt;code&gt;htmx:afterSettle&lt;/code&gt; handler with a pattern like &lt;code&gt;/\/js\/mermaid\.bundle\.[^&amp;quot;']+\.js/&lt;/code&gt;, once per library. Fingerprinted filenames come along for free since the pattern matches whatever hash the current build produced.&lt;/p&gt;
&lt;p&gt;Charts needed a second layer. The theme&amp;rsquo;s chart shortcode wraps its &lt;code&gt;new Chart(...)&lt;/code&gt; call in a &lt;code&gt;DOMContentLoaded&lt;/code&gt; listener, and after an htmx swap that event is ancient history; the listener registers and waits forever. So the chart path re-inserts each inline chart script with &lt;code&gt;addEventListener&lt;/code&gt; temporarily patched to invoke &lt;code&gt;DOMContentLoaded&lt;/code&gt; callbacks immediately, plus a &lt;code&gt;Chart.getChart()&lt;/code&gt; check so nothing draws twice. It is not elegant. It is honest about the constraint: the shortcode&amp;rsquo;s markup is the theme&amp;rsquo;s, and the fix has to meet it where it is.&lt;/p&gt;
&lt;p&gt;If you want the pattern&amp;rsquo;s shape as a takeaway: &lt;strong&gt;conditionally loaded assets and partial navigation are individually fine and jointly broken, and neither feature&amp;rsquo;s documentation will warn you about the other.&lt;/strong&gt; Any site combining per-page bundles with hx-boost, Turbo, or SPA-style routing has this class of bug available to it.&lt;/p&gt;

&lt;h2 class="relative group"&gt;The tests were their own debugging story
 &lt;div id="the-tests-were-their-own-debugging-story" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-tests-were-their-own-debugging-story" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;I added three Playwright regression tests, each walking the failing path on purpose: land on a listing page without the library, click through to a post with it, assert the rendered artifact exists (&lt;code&gt;pre.mermaid svg&lt;/code&gt;, &lt;code&gt;.katex&lt;/code&gt;, a live &lt;code&gt;Chart.getChart()&lt;/code&gt; instance). Two traps surfaced on the way, and they cost more time than the fix itself.&lt;/p&gt;
&lt;p&gt;First, the clicks kept landing on the wrong page. Blowfish&amp;rsquo;s article cards stretch the post link across the whole card and stack tag links on top of it, and Playwright&amp;rsquo;s coordinate-based click aimed at the card&amp;rsquo;s center, which happened to be a tag chip. The katex test spent several runs waiting for math on &lt;code&gt;/tags/georgia-tech/&lt;/code&gt;. The cure is &lt;code&gt;locator.dispatchEvent('click')&lt;/code&gt;, which delivers the event to the exact anchor regardless of what floats above it, plus a &lt;code&gt;waitForURL&lt;/code&gt; assertion so a wrong destination fails fast with a readable error instead of a timeout.&lt;/p&gt;
&lt;p&gt;Second, my shell habit was eating the exit code. &lt;code&gt;npx playwright test | tail&lt;/code&gt; reports &lt;code&gt;tail&lt;/code&gt;&amp;rsquo;s status, which is always zero, and a failing suite sailed through my terminal looking green twice before I noticed. Redirect to a file and check the real exit code. CI was never fooled, because CI does not pipe; only my eyeballs were.&lt;/p&gt;
&lt;p&gt;The affected pages, for the record, included every post in my &lt;a href="https://nick-liu.com/posts/ml-gradient-descent/" &gt;ML math series&lt;/a&gt; and the diagram in the &lt;a href="https://nick-liu.com/posts/first-claude-code-hook/" &gt;hooks post&lt;/a&gt;. All fixed by the same three functions, all guarded by the same three tests.&lt;/p&gt;

&lt;h2 class="relative group"&gt;Lessons
 &lt;div id="lessons" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#lessons" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Per-page asset loading plus body-swap navigation is a bug class, not a bug. If your head is conditional and your navigation is partial, budget for the collision.&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;typeof x !== 'undefined'&lt;/code&gt; guard converts a crash you would notice into a skip you will not. Guards need a fallback path, not just an exit.&lt;/li&gt;
&lt;li&gt;Test the click path, not only the URL path. Direct loads exercise the document pipeline; in-site navigation exercises a completely different one.&lt;/li&gt;
&lt;li&gt;In tests, dispatch events to the element you mean. Coordinate clicks trust the visual stack, and the visual stack lies on layered layouts.&lt;/li&gt;
&lt;li&gt;Never pipe a test runner&amp;rsquo;s output when you care about its exit code.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 class="relative group"&gt;References
 &lt;div id="references" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#references" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://htmx.org/attributes/hx-boost/" target="_blank" rel="noreferrer"&gt;htmx: hx-boost attribute&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.chartjs.org/docs/latest/developers/api.html" target="_blank" rel="noreferrer"&gt;Chart.js: Chart.getChart API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://playwright.dev/docs/api/class-locator#locator-dispatch-event" target="_blank" rel="noreferrer"&gt;Playwright: dispatchEvent&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The fix and tests: &lt;code&gt;layouts/partials/extend-footer.html&lt;/code&gt; and &lt;code&gt;tests/site-enhancements.spec.ts&lt;/code&gt; in this site&amp;rsquo;s repo&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item></channel></rss>