From faa4a06c420f7efa1e59209e27caab29e8c37ba8 Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Wed, 12 Aug 2026 19:11:17 -0400 Subject: [PATCH] Stop a banner rule from being read as a section heading Three # rules open most docs here, so the title became a section too small to survive and the paragraph defining the project got a chunk with no heading. --- AI/lib/chunk.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/AI/lib/chunk.js b/AI/lib/chunk.js index a32982f..bcc7ae3 100644 --- a/AI/lib/chunk.js +++ b/AI/lib/chunk.js @@ -149,7 +149,22 @@ function sectionsFromMarkdown(text) { for (let i = 0; i < lines.length; i++) { if (/^\s*```/.test(lines[i])) { fence = !fence; continue; } if (fence) continue; - if (/^#{1,3}\s+\S/.test(lines[i])) marks.push(i); + // A heading whose text is nothing but rule characters is a banner, not a section. The + // house style opens a document with three of them — + // # ━━━━━━━━ + // # 🏠 VARAVERK + // # ━━━━━━━━ + // — and treating each as a boundary split the title into a section of its own, too small + // to survive, then gave the paragraph that actually defines the project a chunk headed by + // the rule beneath it: no heading, and content opening with 75 identical glyphs. That is + // why "what is Varaverk" returned five script PURPOSE headers and never README.md, which + // has been indexed the whole time. 35 of the 40 markdown files here open this way. + // + // Whole-string test, so an ordinary heading containing a dash is unaffected — "Set-up" + // does not reduce to empty, and a line of dashes does. + if (!/^#{1,3}\s+\S/.test(lines[i])) continue; + if (lines[i].replace(/^#+\s*/, '').replace(/[━─═=~_*\-\s]+/gu, '') === '') continue; + marks.push(i); } if (!marks.length) return [{ heading: null, content: text.trim() }];