Bengal extends Markdown with powerful directives using:::{name}or```{name}syntax. Directives provide rich components like callouts, tabs, cards, and more.
Key Terms
- Directive
- Extended markdown syntax that creates rich components. Bengal supports two syntax styles
:fenced (`{name}) and MyST (:::{name}). - Fenced Syntax
- Directives using triple backticks (e.g.,
`{note}). Used for admonitions, dropdowns, badges, checklists, and include directives. - MyST Syntax
- Directives using triple colons (e.g.,
:::{card}). Used for cards, tabs, buttons, steps, and list tables. Named after the MyST Markdown specification.
Show 30 more terms
Quick Reference
| Directive | Syntax | Purpose | Category |
|---|---|---|---|
{note} |
```{note} |
Information callout | Admonitions |
{warning} |
```{warning} |
Warning callout | Admonitions |
{tip} |
```{tip} |
Tip callout | Admonitions |
{danger} |
```{danger} |
Danger callout | Admonitions |
{cards} |
:::{cards} |
Card grid layout | Layout |
{card} |
:::{card} |
Individual card | Layout |
{tab-set} |
:::{tab-set} |
Tab container | Layout |
{tab-item} |
:::{tab-item} |
Individual tab | Layout |
{dropdown} |
```{dropdown} |
Collapsible section | Layout |
{code-tabs} |
```{code-tabs} |
Multi-language code | Interactive |
{badge} |
```{badge} |
Styled badge | Formatting |
{button} |
:::{button} |
Link button | Formatting |
{steps} |
:::{steps} |
Step-by-step guide | Formatting |
{step} |
:::{step} |
Individual step | Formatting |
{checklist} |
```{checklist} |
Styled checklist | Formatting |
{rubric} |
```{rubric} |
Pseudo-heading | Formatting |
{include} |
```{include} |
Include markdown file | Content Reuse |
{literalinclude} |
```{literalinclude} |
Include code file | Content Reuse |
{list-table} |
:::{list-table} |
Table from lists | Formatting |
{data-table} |
:::{data-table} |
Interactive data table | Interactive |
{youtube} |
:::{youtube} |
YouTube embed (privacy default) | Media |
{vimeo} |
:::{vimeo} |
Vimeo embed (DNT default) | Media |
{video} |
:::{video} |
Self-hosted HTML5 video | Media |
{figure} |
:::{figure} |
Image with caption | Media |
{audio} |
:::{audio} |
Self-hosted HTML5 audio | Media |
{gist} |
:::{gist} |
GitHub Gist embed | Media |
{codepen} |
:::{codepen} |
CodePen embed | Media |
{codesandbox} |
:::{codesandbox} |
CodeSandbox embed | Media |
{stackblitz} |
:::{stackblitz} |
StackBlitz embed | Media |
{asciinema} |
:::{asciinema} |
Terminal recording | Media |
{child-cards} |
:::{child-cards} |
Auto-generate cards from children | Navigation |
{breadcrumbs} |
:::{breadcrumbs} |
Breadcrumb navigation | Navigation |
{siblings} |
:::{siblings} |
Sibling page list | Navigation |
{prev-next} |
:::{prev-next} |
Prev/next links | Navigation |
{related} |
:::{related} |
Related pages by tags | Navigation |
{glossary} |
:::{glossary} |
Render terms from glossary data | Data |
{icon} |
|
Inline SVG icon | Icons |
Directive Syntax
Bengal supports two directive syntax styles:
Fenced Syntax (3 backticks)
1 2 3 4 5 | |
Used for: Admonitions, dropdowns, badges, checklists, code-tabs, include, literalinclude, rubric
MyST Syntax (3 colons)
1 2 3 4 5 | |
Used for: Cards, tabs, buttons, steps, list-table
Nesting with Named Closers
Bengal supports named closers to avoid fence-counting when nesting directives. Use:::{/name}to explicitly close a directive:
Basic Nesting (container with items):
1 2 3 4 5 6 7 8 9 10 11 12 | |
Deep Nesting (admonitions within steps, tabs within cards, etc.):
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Rule: Use:::{/directive-name}to close any container directive. This eliminates the need to count colons.
Categories
Reference for admonition directives (note, warning, tip, danger, etc.)
Reference for layout directives (cards, tabs, dropdown, grid)
Reference for formatting directives (badge, button, steps, checklist, rubric, list-table)
Reference for interactive directives (code-tabs, data-table)
Reference for content reuse directives (include, literalinclude)
Reference for media embed directives (YouTube, Vimeo, video, audio, figure, code playgrounds, terminal recordings)
Reference for navigation directives (child-cards, breadcrumbs, siblings, prev-next, related)
Common Options
Many directives support these common options:
:class:- Custom CSS class:id:- Element ID:title:- Title text (alternative to title in directive name)
Examples
Basic Admonition
1 2 3 | |
Card Grid
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
Tabs
1 2 3 4 5 | |
:::
console.log("Hello");
:::{/tab-set}
## Glossary Directive
The `{glossary}` directive renders terms from a centralized glossary data file (`data/glossary.yaml`) as a styled definition list. Filter terms by tags to show relevant definitions for each page.
### Syntax
```markdown
:::{glossary}
:tags: directives, core
:sorted: true
:collapsed: true
:limit: 3
:::
Options
| Option | Default | Description |
|---|---|---|
:tags: |
(required) | Comma-separated tags to filter terms (OR logic) |
:sorted: |
false |
Sort terms alphabetically |
:show-tags: |
false |
Display tag badges under each term |
:collapsed: |
false |
Wrap in collapsible<details>element |
:limit: |
(all) | Show only first N terms; remaining in expandable section |
:source: |
data/glossary.yaml |
Custom glossary file path |
Examples
Basic Usage - Show terms tagged with "directives":
1 2 3 | |
Progressive Disclosure - Show first 3 terms, rest expandable:
1 2 3 4 | |
Fully Collapsed - Entire glossary in collapsible section:
1 2 3 4 | |
Both Options - Collapsed, with limited terms when expanded:
1 2 3 4 5 | |
Glossary Data Format
Terms are defined indata/glossary.yaml:
1 2 3 4 5 6 7 8 | |
Note: Definitions support inline markdown: backticks forcode,**bold**, and*italic*.
Next Steps
- Browse directive categories above for detailed syntax
- See Content Reuse for include/literalinclude strategies
- Check Writer Quickstart for markdown basics