Extended Syntax
Highlight
Wrap content in highlight markers (==). Supported by many Markdown renderers but not part of the CommonMark spec.
| Factory | Aliases |
|---|---|
b.highlight() | b.high(), b.hl() |
b.highlight("important text")==important text==MarkdownHighlightBlock
└── "important text"subscript
render subscript text using ~ markers.
| factory | aliases |
|---|---|
b.subscript() | b.sub() |
b.paragraph("h", b.sub("2"), "o")h~2~oMarkdownParagraphBlock
├── "h"
├── MarkdownSubscriptBlock
│ └── "2"
└── "o"superscript
render superscript text using ^ markers.
| factory | aliases |
|---|---|
b.superscript() | b.sup() |
b.paragraph("e = mc", b.sup("2"))e = mc^2^MarkdownParagraphBlock
├── "e = mc"
└── MarkdownSuperscriptBlock
└── "2"footnote
add a footnote reference inline. definitions are automatically collected and appended at the end of a b.document() or b.section().
| factory | aliases |
|---|---|
b.footnote() | b.foot(), b.fn() |
const note = b.footnote("this is the footnote content.")
b.document(
b.paragraph("some text", note, " continues here."),
)some text[^1] continues here.
[^1]: this is the footnote content.MarkdownDocument
└── MarkdownParagraphBlock
├── "some text"
├── MarkdownFootnoteBlock [identifier=1]
│ └── footer
│ └── "this is the footnote content."
└── " continues here."If you omit .id(), footnotes are auto-numbered in document order.
Methods
| Method | Description | Aliases |
|---|---|---|
.identifier(value) | Set the footnote identifier | .id() |
const note = b.footnote("This is the footnote content.").id("note")
b.document(
b.paragraph("Some text", note, " continues here."),
)Some text[^note] continues here.
[^note]: This is the footnote content.MarkdownDocument
└── MarkdownParagraphBlock
├── "Some text"
├── MarkdownFootnoteBlock [identifier=note]
│ └── footer
│ └── "This is the footnote content."
└── " continues here."Table
Build type-safe tables with column definitions and rows. Columns are defined as a record mapping keys to header names.
| Factory | Aliases |
|---|---|
b.table(columns, ...rows) | b.tb(), b.t() |
b.table(
{ name: "Name", role: "Role" },
{ name: "Alice", role: "Engineer" },
{ name: "Bob", role: "Designer" },
)| Name | Role |
| ----- | -------- |
| Alice | Engineer |
| Bob | Designer |MarkdownTableBlock [columns=name,role, rows=2]
├── columns
│ ├── "Name"
│ └── "Role"
└── rows
├── row 0
│ ├── "Alice"
│ └── "Engineer"
└── row 1
├── "Bob"
└── "Designer"Methods
| Method | Description | Aliases |
|---|---|---|
.addRow(...rows) | Append rows after construction | .addRows() |
.setColumnAlign(key, align) | Set alignment for a column ("left", "center", "right") | — |
.setColumnMaxWidth(key, width) | Set max character width for a column | — |
.style(align) | Set default alignment for all columns | — |
b.table(
{ name: "Name", role: "Role" },
{ name: "Alice", role: "Engineer" },
).addRow(
{ name: "Bob", role: "Designer" },
)| Name | Role |
| ----- | -------- |
| Alice | Engineer |
| Bob | Designer |MarkdownTableBlock [columns=name,role, rows=2]
├── columns
│ ├── "Name"
│ └── "Role"
└── rows
├── row 0
│ ├── "Alice"
│ └── "Engineer"
└── row 1
├── "Bob"
└── "Designer"b.table(
{ name: "Name", score: "Score" },
{ name: "Alice", score: "95" },
).setColumnAlign("score", "right")| Name | Score |
| ----- | ---: |
| Alice | 95 |MarkdownTableBlock [columns=name,score, rows=1]
├── columns
│ ├── "Name"
│ └── "Score"
└── rows
└── row 0
├── "Alice"
└── "95"b.table(
{ name: "Name", bio: "Bio" },
{ name: "Alice", bio: "Software engineer with 10 years of experience" },
).setColumnMaxWidth("bio", 20)| Name | Bio |
| ----- | -------------------- |
| Alice | Software engineer... |MarkdownTableBlock [columns=name,bio, rows=1]
├── columns
│ ├── "Name"
│ └── "Bio"
└── rows
└── row 0
├── "Alice"
└── "Software engineer with 10 years of experience"b.table(
{ name: "Name", role: "Role" },
{ name: "Alice", role: "Engineer" },
).style("center")| Name | Role |
| :---: | :---: |
| Alice | Engineer |MarkdownTableBlock [style=center, columns=name,role, rows=1]
├── columns
│ ├── "Name"
│ └── "Role"
└── rows
└── row 0
├── "Alice"
└── "Engineer"Pass an object instead of a string for advanced column config:
b.table(
{
name: { name: "Name", align: "left" },
score: { name: "Score", align: "right", maxWidth: 10 },
},
{ name: "Alice", score: "95" },
{ name: "Bob", score: "87" },
)| Name | ... |
| :--- | ---: |
| Alice | 95 |
| Bob | 87 |MarkdownTableBlock [columns=name,score, rows=2]
├── columns
│ ├── "Name"
│ └── "Score"
└── rows
├── row 0
│ ├── "Alice"
│ └── "95"
└── row 1
├── "Bob"
└── "87"Math
Render math expressions. Single-line content renders as inline math ($...$), multiline as a display block ($$...$$).
| Factory | Aliases |
|---|---|
b.math() | — |
b.math("E = mc^2")$E = mc^2$MarkdownMathBlock
└── "E = mc^2"b.math("\\sum_{i=1}^{n} i", "= \\frac{n(n+1)}{2}")$$
\sum_{i=1}^{n} i= \frac{n(n+1)}{2}
$$MarkdownMathBlock
├── "\sum_{i=1}^{n} i"
└── "= \frac{n(n+1)}{2}"