Skip to content

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

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

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

@tonycoder-hub

Copy link
Copy Markdown
Author

Closing as stale — opened on or before 2026-08-17 and still unmerged.

@github-actions github-actions Bot locked and limited conversation to collaborators Aug 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant