Skip to content
Parser
Markdown
parsers: [parserMd()]
Officialv5.8.3kubb >=5.8.0node >=22

Markdown

@kubb/parser-md

Writes .md and .markdown files from the Kubb AST, with YAML frontmatter from a file's meta.

kubb add parser-md
markdownfrontmatterparserdocsyaml

The Markdown parser writes .md and .markdown files. It joins a file's source blocks as plain Markdown, separated by blank lines. When the file sets meta.frontmatter, it adds that object as YAML frontmatter at the top.

It takes no options. Kubb registers it by default with the TypeScript parsers.

Installation

bun add -d @kubb/parser-md

Or run kubb add parser-md to install the version the Kubb registry pins and add parserMd() to kubb.config.ts.

Setup

Add it yourself only when you set a custom parsers array, since that array replaces the default set. List every parser your plugins need. Files no parser claims are written as their source text.

Example

kubb.config.ts
import { defineConfig } from 'kubb/config'
import { parserMd } from '@kubb/parser-md'
import { parserTs, parserTsx } from '@kubb/parser-ts'

export default defineConfig({
  input: './petStore.yaml',
  output: { path: './src/gen' },
  parsers: [parserTs(), parserTsx(), parserMd()],
  plugins: [],
})

Dependencies

No extension dependencies.