Markdown Header Text Splitter avatar

Markdown Header Text Splitter

Try for free

2 hours trial then $20.00/month - No credit card required now

Go to Store
Markdown Header Text Splitter

Markdown Header Text Splitter

codepoetry/markdown-splitter
Try for free

2 hours trial then $20.00/month - No credit card required now

Split Markdown into structured chunks using header hierarchy. Built with LangChain, it preserves metadata for RAG, documentation, and analysis. Configure headers, strip content, and integrate with vector databases. Ideal for AI workflows.

Developer
Maintained by Community

Actor Metrics

  • 2 Monthly users

  • No reviews yet

  • No bookmarks yet

  • Created in Mar 2025

  • Modified a day ago

📄 Markdown Header Splitter Actor

Split Markdown content into structured chunks using header hierarchy

This actor intelligently splits Markdown documents into semantically meaningful chunks based on header hierarchy. Built with LangChain's MarkdownHeaderTextSplitter, it preserves metadata and structure for downstream applications like RAG systems, documentation processing, and content analysis.


🚀 Key Features

Header-Based Chunking
Split content at specified header levels (e.g., #, ##, ###).

Metadata Preservation
Each chunk includes hierarchical header metadata for context tracking.

Flexible Configuration

  • Choose which headers to split on
  • Strip headers from content or retain them
  • Works with any Markdown content

RAG-Ready Output
Chunks are formatted for direct use in vector databases or LLM pipelines.


📝 Use Cases

  1. RAG Systems
    Split long documents into context-aware chunks for:

    • Vector database indexing
    • Context window optimization
    • Knowledge retrieval
  2. Documentation Processing
    Break technical docs into sections for:

    • Summarization
    • Translation
    • Search indexing
  3. Content Analysis
    Analyze/report on document structure (e.g., API reference parsing).


🛠️ Getting Started

Installation

  1. Create an Apify account at apify.com
  2. Navigate to Actor → Search for markdown-splitter
  3. Run with Sample Input:
    1{
    2  "markdown_text": "# Title\n## Section 1\nContent...\n## Section 2\nMore content...",
    3  "headers_to_split_on": ["#", "##"],
    4  "strip_headers": true
    5}

Input Parameters

FieldTypeDescription
markdown_textstringMarkdown content to split (required)
headers_to_split_onarrayHeader levels to split on (default: ["#", "##", "###", "####", "#####", "######"])
strip_headersbooleanRemove headers from chunk content (default: true)

Output Format

1{
2  "chunks": [
3    {
4      "content": "Section content here",
5      "metadata": {
6        "Header 1": "Title",
7        "Header 2": "Section 1"
8      }
9    },
10    ...
11  ]
12}

📚 Example Workflow: RAG System Integration

  1. Input: Technical documentation in Markdown
  2. Process:
    • Split into sections using ## headers
    • Strip headers to focus on content
  3. Output:
    • Chunks with hierarchy metadata → Embed with OpenAI/LLama
    • Store in your favorite vector database like : ChromaDB/Pinecone/Weaviate for retrieval