From 066fe1954cbd1dcf1e7816eb724ef576373a2049 Mon Sep 17 00:00:00 2001 From: garrytan Date: Mon, 26 Oct 2026 13:22:04 +0000 Subject: [PATCH] fix: preamble-hoist's section splitter closes a fence only on a bare delimiter (ship Step 11) Inside an open fence, a line such as "```bash" is content in CommonMark, but splitSections treated it as the closing fence, so a later "## " line in the same block could split a section mid-code-block and hoist half of it. A closing delimiter now needs nothing but whitespace after it. Every host's render is unchanged (gen-skill-docs --dry-run FRESH on all twelve hosts). Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- scripts/resolvers/preamble-hoist.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/resolvers/preamble-hoist.ts b/scripts/resolvers/preamble-hoist.ts index 4f8d1f743..7f3728329 100644 --- a/scripts/resolvers/preamble-hoist.ts +++ b/scripts/resolvers/preamble-hoist.ts @@ -35,10 +35,10 @@ function splitSections(text: string, marker = '## '): string[] { let current: string[] = []; let fence: string | null = null; for (const line of text.split('\n')) { - const delimiter = /^ {0,3}(`{3,}|~{3,})/.exec(line)?.[1]; + const [, delimiter, info] = /^ {0,3}(`{3,}|~{3,})(.*)$/.exec(line) ?? []; if (delimiter) { if (!fence) fence = delimiter; - else if (delimiter[0] === fence[0] && delimiter.length >= fence.length) fence = null; + else if (delimiter[0] === fence[0] && delimiter.length >= fence.length && !info.trim()) fence = null; } else if (!fence && line.startsWith(marker) && current.some(l => l.trim())) { sections.push(current.join('\n').trim()); current = [];