Skip to content

fix: stop prefixing markdown chunks with the string undefined - #13149

Open
tonycoder-hub wants to merge 1 commit into
continuedev:mainfrom
tonycoder-hub:cursor/fix-markdown-chunker-undefined-header-prefix-4e6d
Open

fix: stop prefixing markdown chunks with the string undefined#13149
tonycoder-hub wants to merge 1 commit into
continuedev:mainfrom
tonycoder-hub:cursor/fix-markdown-chunker-undefined-header-prefix-4e6d

Conversation

@tonycoder-hub

Copy link
Copy Markdown

markdownChunker prepends each section header to every chunk. When a section has no header, findHeader returns undefined and the template literal interpolated it as the literal text "undefined". Headerless docs were indexed with up to five bogus undefined lines at the top of every chunk (used by @docs indexing).

Only prepend the header when the section actually has one.

Tests: cd core && npx vitest run indexing/chunk/markdown.vitest.ts — 3 passed. Distinct from #13140-#13148.

…ned"

markdownChunker recurses one header level at a time and prepends each
section's header to every chunk it produces. When a section has no
header, findHeader returns undefined and the template literal
interpolated it as the literal text "undefined", so headerless docs
were indexed with up to five bogus "undefined" lines at the top of
every chunk.

Only prepend the header when the section actually has one.
@tonycoder-hub
tonycoder-hub requested a review from a team as a code owner August 17, 2026 10:57
@tonycoder-hub
tonycoder-hub requested review from sestinj and removed request for a team August 17, 2026 10:57
@tonycoder-hub

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant