Skip to main content
The MarkdownChef processes markdown files and strings, extracting tables, code blocks, and images into a structured MarkdownDocument. It intelligently parses markdown content and separates it into distinct components while preserving their positions in the original text.

Installation

MarkdownChef is included in the base installation of Chonkie. No additional dependencies are required.
For installation instructions, see the Installation Guide.

Initialization

Parameters

Union[TokenizerProtocol, str]
default:"character"
Tokenizer to use for counting tokens in text chunks. Can be a string identifier (“character”, “gpt2”, etc.) or a tokenizer instance that follows the TokenizerProtocol.

Methods

process()

Process a markdown file.

Parameters

Union[str, Path]
required
Path to the markdown file (string or Path object)

Returns

MarkdownDocument containing parsed content with extracted tables, code, images, and text chunks

process_batch()

Process multiple markdown files at once.

Parameters

list[Union[str, Path]]
required
List of file paths to process

Returns

List of MarkdownDocument objects

Basic Usage

Return Type

MarkdownChef returns a MarkdownDocument object, which extends the base Document class with additional fields: