Skip to content
Officialv5.8.2MITkubb >=5.0.0node >=22

@kubb/parser-md

Emits `.md` and `.markdown` files from the Kubb AST, joining source blocks as plain markdown and prepending YAML frontmatter from a file's meta.

markdownfrontmatterparserdocsyaml
Stijn Van Hulle

Stijn Van Hulle

@stijnvanhulle

Downloads
172.2K/ mo
Stars
1.8K
Bundle size
24.4 kB
Updated
1h ago

Generate .md and .markdown files.

  • Join source blocks and prepend file.meta.frontmatter as YAML.
  • Runs by default with the TypeScript parsers. Takes no options.
A custom parsers array replaces the default set. Include every parser your plugins need. Unmatched files are written as source text.

Installation

Ships with kubb, no extra install.

Dependencies

  • No plugin dependencies.
  • Register custom parsers on defineConfig.parsers.

Example

Register the Markdown parser explicitly when overriding the default parser set.

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: [],
})