Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
HTML agent-skillsai-agentsarchitecture-diagramclaude-codeclaude-skillscodexcoding-agentsdeepseek-harnessdeveloper-toolsdiagramsdiagrams-as-codedsh-pluginflowchartllmmermaidopencodesequence-diagramsoftware-architecturesystem-designvisualization
fix(delta): look up srcdoc canvases from body, not the whole document
uygnoey2f01bf0baa79
diff --git a/archify.zip b/archify.zipindex c383258c..1b8ea131 100644Binary files a/archify.zip and b/archify.zip differdiff --git a/archify/delta/architecture-delta.mjs b/archify/delta/architecture-delta.mjsindex 7c551923..166eca68 100644--- a/archify/delta/architecture-delta.mjs+++ b/archify/delta/architecture-delta.mjs@@ -1173,13 +1173,15 @@ html[data-theme="dark"] body{background:#071019!important;background-image:none!function fillDeltaSrcdoc(html, slots) {const fills = [];+ const bodyStart = html.lastIndexOf('<body>');+ const from = bodyStart === -1 ? 0 : bodyStart;for (const [view, token, nested] of slots) {if (!nested) continue;- const open = html.match(new RegExp(`<section class="canvas" data-view="${view}"[^>]*>`));- if (!open || open.index == null) continue;- const regionStart = open.index + open[0].length;+ const open = html.indexOf(`<section class="canvas" data-view="${view}"`, from);+ if (open === -1) continue;+ const regionStart = html.indexOf('>', open) + 1;const regionEnd = html.indexOf('</section>', regionStart);- if (regionEnd === -1) continue;+ if (regionStart <= 0 || regionEnd === -1) continue;const localIndex = html.slice(regionStart, regionEnd).indexOf(token);if (localIndex === -1) continue;fills.push({ index: regionStart + localIndex, token, nested: esc(nested) });diff --git a/archify/test/architecture-delta.test.mjs b/archify/test/architecture-delta.test.mjsindex 6aa3340c..0cc2b320 100644--- a/archify/test/architecture-delta.test.mjs+++ b/archify/test/architecture-delta.test.mjs@@ -196,15 +196,16 @@ test('srcdoc slots are filled inside their canvas even when artifact CSS repeatsheadSvg: '<svg viewBox="0 0 1 1"></svg>',baseHtml,headHtml,- artifactCss: `/* ${baseSlot} ${headSlot} */`,+ artifactCss: `/* ${baseSlot} ${headSlot} <section class="canvas" data-view="base" hidden></section><section class="canvas" data-view="head" hidden></section> */`,});const style = html.match(/<style>([\s\S]*?)<\/style>/)?.[1] || '';assert.match(style, /\/\*[\s\S]*srcdoc=""[\s\S]*\*\//);assert.equal(style.includes('css-base'), false);assert.equal(style.includes('css-head'), false);- const frames = [...html.matchAll(/<section class="canvas" data-view="(base|head)"[^>]*>([\s\S]*?)<\/section>/g)]- .map(([, view, body]) => [view, body]);- const srcdoc = (body) => body.match(/srcdoc="([^"]*)"/)?.[1]+ const body = html.slice(html.lastIndexOf('<body>'));+ const frames = [...body.matchAll(/<section class="canvas" data-view="(base|head)"[^>]*>([\s\S]*?)<\/section>/g)]+ .map(([, view, section]) => [view, section]);+ const srcdoc = (section) => section.match(/srcdoc="([^"]*)"/)?.[1]?.replaceAll('"', '"').replaceAll(''', "'").replaceAll('<', '<')