Skip to content

textsplitter: preserve Markdown options in nested contexts - #1560

Open
po-et wants to merge 2 commits into
tmc:mainfrom
po-et:fix/markdown-nested-options
Open

po-et wants to merge 2 commits into
tmc:mainfrom
po-et:fix/markdown-nested-options

Conversation

@po-et

@po-et po-et commented Oct 21, 2026

Copy link
Copy Markdown

MarkdownTextSplitter accepts WithCodeBlocks, WithReferenceLinks, and WithJoinTableRows, but recursive contexts lose all three settings. For example, a fenced code block inside a blockquote disappears even with WithCodeBlocks(true). Nested reference links are expanded when expansion is disabled, and quoted tables repeat their header even when rows should be joined.

Copy these existing settings when cloning the context. The change also updates the generated Markdown example to preserve the original inline text in nested blocks with the default ReferenceLinks(false) setting.

Regression tests cover top-level and nested blocks, both option values, and document metadata. This is related to #1439, but does not address its separate list-item code-block parsing or heading/chunking behavior.

Validation: Go 1.26.9 on macOS arm64; go test -race -count=1 -v ./textsplitter ./documentloaders, go vet ./textsplitter ./documentloaders, go build ./..., and golangci-lint v2.9.0. The existing AssemblyAI integration test skips without a service key; no live provider tests were run.

Developed with assistance from OpenAI Codex, with separate agent review and public-API checks.

  • Read the contributing documentation and code of conduct.
  • Use the affected package as the title prefix.
  • Check existing pull requests for duplicate fixes.
  • Describe the problem and the scope of this fix.
  • Add regression coverage; no new public API or concept.
  • Pass golangci-lint checks.

This branch has not been deployed

No deployments
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