npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

n8n-nodes-markdown-chunker

v0.1.2

Published

n8n node that splits Markdown into retrieval-ready chunks with heading-aware metadata for RAG and vector stores

Readme

n8n-nodes-markdown-chunker

npm version n8n community node AI Agent Tool License: MIT

An n8n community node that splits Markdown into retrieval-ready chunks with heading-aware metadata — the missing link between document conversion and your vector store.

convert → chunk → embed. Pair it with n8n-nodes-docx-to-md or n8n-nodes-url-to-md to turn any document or web page into clean Markdown, then slice it into chunks an embeddings model can actually use.

Why this node

Generic text splitters cut on character counts. They happily slice a code block in half, tear a table apart, and strip the heading context a retriever needs to rank a passage. Markdown Chunker understands document structure:

  • Heading-hierarchy splitting — start a fresh chunk at #/##/### headings, down to a configurable depth.
  • Parent-heading path on every chunkmetadata.headingPath carries the ancestor headings (e.g. ["Guide", "Setup"]), so a retrieved chunk keeps its context.
  • Atomic code blocks & tables — fenced code (```/~~~) and GFM tables are never broken across a chunk boundary.
  • Size target + overlap — a soft character target with optional overlap for size-driven splits.
  • Zero runtime dependencies, no fs/env access — eligible for the n8n Cloud verified-node panel.
  • usableAsTool: true — callable directly by AI agents.

Installation

In n8n: Settings → Community Nodes → Install, then enter n8n-nodes-markdown-chunker.

Or with npm in a self-hosted instance:

npm install n8n-nodes-markdown-chunker

Use as an AI Agent tool

The node ships with usableAsTool: true, so an AI Agent can call it directly — e.g. to chunk a document it just fetched before embedding it.

On n8n Cloud and recent self-hosted versions this works out of the box. On older self-hosted instances, enable community-node tool usage:

N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true

Then attach Markdown Chunker to an AI Agent's Tool input.

Parameters

| Field | Default | Description | | --- | --- | --- | | Source Field | markdown | Input field holding the Markdown text to chunk. | | Destination Output Field | text | Output field that receives each chunk's text. | | Max Heading Depth | 3 | Start a new chunk at ATX headings of this level or shallower (1 = only #). | | Target Chunk Size (Chars) | 1000 | Soft target in characters. 0 splits on headings only. Code/tables are never broken, so a single large block may exceed this. | | Chunk Overlap (Chars) | 0 | Trailing context from the previous chunk to prepend when a chunk is split because of size. |

Output

One n8n item per chunk:

{
  "text": "## Setup\n\nInstall the package...",
  "headingPath": ["Guide", "Setup"],
  "index": 1,
  "charCount": 312,
  "approxTokens": 78
}

approxTokens is a charCount / 4 heuristic — deliberately no tiktoken dependency, to keep the package dependency-free. Treat it as a rough estimate.

Before / after retrieval

Without structure-aware chunking, a naive splitter might produce:

...end of the authentication section. # Billing You are charged monthly...

— two unrelated topics fused into one chunk, and a heading buried mid-text. Markdown Chunker instead yields a clean Billing chunk whose headingPath is ["Billing"], so your retriever ranks it correctly and your LLM sees the right context.

Example workflow

HTTP Request / Read File
        │
        ▼
  URL to MD / Docx to MD      (convert → Markdown)
        │
        ▼
   Markdown Chunker           (chunk → {text, headingPath, ...})
        │
        ▼
 Embeddings + Vector Store    (embed → store)

Development

npm install
npm test           # jest, 100% coverage gate
npm run lint       # n8n-node lint (cloud-eligibility checks)
npm run build      # n8n-node build

License

MIT © Sergei Frangulov