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
npm install ts-markdown-builderimport * 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!',
]),
]);# Welcome 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[])- join blocks of text into a single markdown document (string)
heading(text: string, options?: { level: number = 1 })blockquote(text: string | string[])codeBlock(text: string, options?: { language?: string = '' })list(items: string[])orderedList(items: string[])horizontalRule
bold(text: string)italic(text: string)code(text: string)link(url: string, text?: string)- link or autolinkimage(url: string, text?: string)escape(text: string)
table(headers: string[], rows: string[][])
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
TODO