parsers: [parserMd()]Markdown parser
@kubb/parser-md
Writes .md and .markdown files from the Kubb AST, with YAML frontmatter from a file's meta.
- Downloads405.9K/ monthnpm, last 30 days
- GitHub stars1.8Kkubb-labs/kubb
- Unpacked size22.9kBv5.21.2 on npm
- Latest release21m agov5.21.2 · Nov 19, 2026
The Markdown parser writes the .md and .markdown files that plugins generate, with YAML frontmatter from each file's meta.frontmatter.
It joins each file's source blocks with blank lines and writes the frontmatter above the content.
Installation
kubb add parser-mdbun add -d @kubb/parser-mdpnpm add -D @kubb/parser-mdnpm install --save-dev @kubb/parser-mdyarn add -D @kubb/parser-mdkubb add installs the version the Kubb registry pins and adds parserMd() to kubb.config.ts. It needs a kubb.config.ts, so run kubb init first in a new project.
Setup
No setup is needed. defineConfig and the bundler integrations register parserMd() by default, next to parserTs() and parserTsx().
parsers array replaces the default set, so add parserMd() to it yourself and list every parser your plugins need. A file that no parser claims is written as its source text only, without imports, exports, banner, or footer.Options worth knowing
The parser takes no options. A plugin controls the output per file:
| File setting | Default | What it does |
|---|---|---|
meta.frontmatter | None | Writes the object as YAML frontmatter. null or {} writes none. |
banner | None | Goes above the frontmatter. |
footer | None | Goes below the content. |
Example
This config sets a custom parsers array that keeps the Markdown parser. A plugin file with meta.frontmatter then prints like this:
import { defineConfig } from 'kubb/config'
import { parserMd } from '@kubb/parser-md'
import { parserTs, parserTsx } from '@kubb/parser-ts'
import { pluginTs } from '@kubb/plugin-ts'
export default defineConfig({
input: './petStore.yaml',
output: { path: './src/gen' },
parsers: [parserTs(), parserTsx(), parserMd()],
plugins: [pluginTs()],
})---
title: API Reference
layout: doc
---
Endpoints generated from the OpenAPI spec.Dependencies
No extension dependencies.
