Skip to main content

Overview

Markdown splitter parses Markdown syntax to identify structural boundaries like headers, code blocks, tables, and lists. Segments content by semantic blocks and preserves document hierarchy through header tracking. Splitter Class: MarkdownChunker Config Class: MarkdownChunkingConfig

Dependencies

No additional dependencies required. Uses standard library.

Examples

Parameters

ParameterTypeDescriptionDefaultSource
chunk_sizeintTarget size of each chunk1024Base
chunk_overlapintOverlapping units between chunks200Base
min_chunk_sizeint | NoneMinimum size for a chunkNoneBase
length_functionCallable[[str], int]Function to measure text lengthlenBase
strip_whitespaceboolStrip leading/trailing whitespaceFalseBase
split_on_elementslist[str]Elements that signify boundaries["h1", "h2", "h3", "code_block", "table", "horizontal_rule"]Specific
preserve_whole_elementslist[str]Indivisible element types["code_block", "table"]Specific
strip_elementsboolStrip Markdown syntax charactersTrueSpecific
preserve_original_contentboolPreserve original markdown contentFalseSpecific
text_chunker_to_useBaseChunkerChunker for oversized blocksRecursiveChunkerSpecific