Elegant markdown builder with minimal bundle size.
npm install ts-markdown-builder
!Build
!npm bundle size


Elegant markdown builder with minimal bundle size.
TypeScript markdown generation library:
- easy to read and write API
- build CommonMark & GFM compliant markdown
- minimal bundle size + tree-shakable
``sh`
npm install ts-markdown-builder
`js
import * as md from 'ts-markdown-builder';
const output = md.joinBlocks([
md.heading('Welcome to TS Markdown Builder'),
"It's an easy to use modern markdown generator.",
'It supports:',
md.list([
${md.bold('bold')} and ${md.italic('italic')},${md.code('code')} spans and code blocks
,`
'unordered and ordered lists',
'blockquotes',
'and more!',
]),
]);
`markdownWelcome to TS Markdown Builder
It's an easy to use modern markdown generator.
It supports:
- bold and _italic_
- \code\ spans and code blocks`
- unordered and ordered lists
- blockquotes
- and more!
- [joinBlocks(blocks: string[])](https://github.com/mdjastrzebski/ts-markdown-builder/blob/main/API.md#joinblocks) - join blocks of text into a single markdown document (string)
](https://github.com/mdjastrzebski/ts-markdown-builder/blob/main/API.md#blockquote)
- codeBlock(text: string, options?: { language?: string = '' })
- [list(items: string[])](https://github.com/mdjastrzebski/ts-markdown-builder/blob/main/API.md#list)
- [orderedList(items: string[])](https://github.com/mdjastrzebski/ts-markdown-builder/blob/main/API.md#orderedlist)
- [taskList(items: (string | TaskListItem)[])](https://github.com/mdjastrzebski/ts-markdown-builder/blob/main/API.md#tasklist) - GFM task list with checkboxes (items can be strings or { text: string, done?: boolean })
- horizontalRule$3
bold(text: string)
- italic(text: string)
- strikethrough(text: string) - GFM strikethrough
- code(text: string)
- link(url: string, text?: string) - link or autolink
- image(url: string, text?: string)
- escape(text: string)$3
- [
table(headers: string[], rows: string[][])](https://github.com/mdjastrzebski/ts-markdown-builder/blob/main/API.md#table)$3
disclosure(title: string, content: string, options?: { open?: boolean })
- lineBreak`See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
See the full API Reference for detailed documentation, parameter descriptions, and usage examples.