Create headings from level 1 (#) through level 6 (######).
Factory Aliases b.heading()b.head(), b.h()
Typescript Markdown Structure
b. heading ( "Introduction" ) MarkdownHeadingBlock
└── "Introduction"
Method Description Aliases .level(1–6)Set the heading level .l().identifier(value)Set a custom anchor identifier .id()
Typescript Markdown Structure
b. heading ( "Introduction" ). level ( 3 ) MarkdownHeadingBlock [level=3]
└── "Introduction"
Typescript Markdown Structure
b. heading ( "API Reference" ). level ( 2 ). id ( "api-ref" ) ## API Reference {#api-ref} MarkdownHeadingBlock [identifier=api-ref, level=2]
└── "API Reference"
Calling .level() locks the heading level — subsequent .level() calls are ignored. This prevents accidental overwrites.
When headings are placed inside a b.document() or b.section(), their levels are derived from the nesting depth instead. Auto-nesting unlocks heading levels so depth propagation can adjust them. See Heading Depth for details.
A plain paragraph block. Content is rendered as-is without any wrapping markers.
Factory Aliases b.paragraph()b.para(), b.p()
Typescript Markdown Structure
b. paragraph ( "Hello, world!" ) MarkdownParagraphBlock
└── "Hello, world!"
Typescript Markdown Structure
b. paragraph ( "Mix " , b. bold ( "bold" ), " and " , b. italic ( "italic" ), " freely." ) Mix **bold** and *italic* freely. MarkdownParagraphBlock
├── "Mix "
├── MarkdownBoldBlock
│ └── "bold"
├── " and "
├── MarkdownItalicBlock
│ └── "italic"
└── " freely."
Wrap content in bold markers.
Factory Aliases b.bold()b.b()
Typescript Markdown Structure
MarkdownBoldBlock
└── "important"
Method Description Aliases .style("**" | "__")Choose asterisk or underscore style. Default: ** —
Typescript Markdown Structure
b. bold ( "important" ). style ( "__" ) MarkdownBoldBlock [style=__]
└── "important"
Wrap content in italic markers.
Factory Aliases b.italic()b.i()
Typescript Markdown Structure
MarkdownItalicBlock
└── "emphasis"
Method Description Aliases .style("*" | "_")Choose asterisk or underscore style. Default: * —
Typescript Markdown Structure
b. italic ( "emphasis" ). style ( "_" ) MarkdownItalicBlock [style=_]
└── "emphasis"
Create an inline link. If no label is provided, the URL is rendered as an autolink.
Factory Aliases b.link(url, ...label)b.url()
Typescript Markdown Structure
b. link ( "https://example.com" , "Example" ) [ Example ]( https://example.com ) MarkdownLinkBlock [url=https://example.com]
└── "Example"
Typescript Markdown Structure
b. link ( "https://example.com" ) MarkdownLinkBlock [url=https://example.com]
Method Description Aliases .target(value)Set the link target. Renders as an <a> tag when used —
Type Description _blankOpen in a new tab or window _selfOpen in the current frame (default) _parentOpen in the parent frame _topOpen in the full body of the window
Typescript Markdown Structure
b. link ( "https://example.com" , "Example" ). target ( "_blank" ) < a href = "https://example.com" target = "_blank" >Example</ a > MarkdownLinkBlock [url=https://example.com, target=_blank]
└── "Example"
Embed an image with alt text.
Factory Aliases b.image(src, ...alt)b.img()
Typescript Markdown Structure
b. image ( "photo.png" , "A sunset" ) MarkdownImageBlock [src=photo.png]
└── "A sunset"
Method Description Aliases .caption(...content)Add a figure caption (renders as <figure> HTML) —
Typescript Markdown Structure
b. image ( "photo.png" , "A sunset" ). caption ( "Fig 1. Sunset" ) < figure >
< img src = "photo.png" alt = "A sunset" >
< figcaption >Fig 1. Sunset</ figcaption >
</ figure > MarkdownImageBlock [src=photo.png]
├── alt
│ └── "A sunset"
└── caption
└── "Fig 1. Sunset"
Create inline code or fenced code blocks. Multiline content automatically renders as a fenced block.
Factory Aliases b.code()b.codeblock()
Typescript Markdown Structure
MarkdownCodeBlock
└── "hello"
Typescript Markdown Structure
b. code ( "const x = 1" , "const y = 2" ) ```
const x = 1
const y = 2
``` MarkdownCodeBlock
├── "const x = 1"
└── "const y = 2"
Method Description Aliases .language(lang)Set the language for syntax highlighting .lang()
Typescript Markdown Structure
b. code ( "const x = 1" , "const y = 2" ). language ( "ts" ) ```ts
const x = 1
const y = 2
``` MarkdownCodeBlock [language=ts]
├── "const x = 1"
└── "const y = 2"
The codeblock() alias auto-detects the language from the last argument if it is a common language identifier:
Typescript Markdown Structure
b. codeblock ( "const x = 1" , "ts" ) MarkdownCodeBlock [language=ts]
└── "const x = 1"
Code renders as inline or fenced depending on the content:
Inline : Single content argument with no .language() set renders as backtick-wrapped inline code.
Fenced : Multiple content arguments or a .language() call renders as a triple-backtick fenced block.
Create a blockquote. Lines are prefixed with > .
Factory Aliases b.blockquote()b.block(), b.bq()
Typescript Markdown Structure
b. blockquote ( "To be or not to be." ) _MarkdownBlockquoteBlock
└── "To be or not to be."
Typescript Markdown Structure
b. blockquote (
"First paragraph." ,
"Second paragraph."
) > First paragraph.
> Second paragraph. _MarkdownBlockquoteBlock
├── "First paragraph."
└── "Second paragraph."
Blockquotes can be nested. Inner blockquotes use >> (without a space between > markers):
Typescript Markdown Structure
b. blockquote (
"Outer quote." ,
b. blockquote ( "Inner quote." ),
) > Outer quote.
>> Inner quote. _MarkdownBlockquoteBlock
├── "Outer quote."
└── _MarkdownBlockquoteBlock
└── "Inner quote."
See also: Blockquote Alerts for GitHub-flavored alert syntax.
Insert a horizontal rule (thematic break).
Factory Aliases b.horizontalRule()b.hr()
Typescript Markdown Structure
MarkdownHorizontalRuleBlock
Method Description Aliases .style("-" | "*" | "_")Choose the rule character. Default: - — .count(n)Set the number of characters (minimum 3) —
Typescript Markdown Structure
b. hr (). style ( "*" ). count ( 5 ) MarkdownHorizontalRuleBlock [style=*, count=5]
Create a numbered list. Items are automatically wrapped.
Factory Aliases b.list.ordered()b.list.ol()
Typescript Markdown Structure
b.list. ordered ( "First" , "Second" , "Third" ) 1. First
2. Second
3. Third MarkdownOrderedListBlock
├── MarkdownOrderedListItemBlock [index=1]
│ └── "First"
├── MarkdownOrderedListItemBlock [index=2]
│ └── "Second"
└── MarkdownOrderedListItemBlock [index=3]
└── "Third"
Method Description Aliases .startingIndex(n)Set the starting number —
Typescript Markdown Structure
b.list. ordered ( "First" , "Second" ). startingIndex ( 5 ) MarkdownOrderedListBlock
├── MarkdownOrderedListItemBlock [index=5]
│ └── "First"
└── MarkdownOrderedListItemBlock [index=6]
└── "Second"
Lists can be nested by passing a list block as an item:
Typescript Markdown Structure
b.list. ordered (
"Item one" ,
b.list. ordered ( "Nested A" , "Nested B" ),
"Item two" ,
) 1. Item one
1. Nested A
2. Nested B
2. Item two MarkdownOrderedListBlock
├── MarkdownOrderedListItemBlock [index=1]
│ └── "Item one"
├── MarkdownOrderedListBlock [indent=2]
│ ├── MarkdownOrderedListItemBlock [index=1]
│ │ └── "Nested A"
│ └── MarkdownOrderedListItemBlock [index=2]
│ └── "Nested B"
└── MarkdownOrderedListItemBlock [index=2]
└── "Item two"
Nested lists are indented by 2 spaces by default. Override this globally with enforce.list.indent in Rendering Options .
Create a bulleted list.
Factory Aliases b.list.unordered()b.list.ul()
Typescript Markdown Structure
b.list. unordered ( "Apples" , "Bananas" , "Cherries" ) - Apples
- Bananas
- Cherries MarkdownUnorderedListBlock
├── MarkdownUnorderedListItemBlock
│ └── "Apples"
├── MarkdownUnorderedListItemBlock
│ └── "Bananas"
└── MarkdownUnorderedListItemBlock
└── "Cherries"
Method Description Aliases .style("-" | "*" | "+")Set the bullet character for all items —
Typescript Markdown Structure
b.list. unordered ( "Apples" , "Bananas" ). style ( "*" ) MarkdownUnorderedListBlock
├── MarkdownUnorderedListItemBlock [style=*]
│ └── "Apples"
└── MarkdownUnorderedListItemBlock [style=*]
└── "Bananas"
Insert a line break (\n).
Factory Aliases b.lineBreak()b.br()
Typescript Markdown Structure
b. paragraph ( "Line one" , b. br (), "Line two" ) MarkdownParagraphBlock
├── "Line one"
├── MarkdownLineBreakBlock
└── "Line two"