Content Authoring

Markdown, MyST directives, and rich content

3 min read 626 words

Bengal uses CommonMark Markdown with MyST-style directive extensions for rich documentation. Write in standard Markdown and extend with 60+ built-in directives.

What Do You Need?

Quick Reference

**bold** and *italic*
~~strikethrough~~
`inline code`
[External](https://example.com)
[Internal](/docs/get-started/)
[[Cross-reference]] docs/page
[[#heading]] Anchor link
[[ext:python:pathlib.Path]]
$E = mc^2$
$$
\sum_{i=1}^n x_i
$$
{math}`\frac{a}{b}`
```python
def hello():
    print("Hello!")
```

With line highlighting:

```python {hl_lines="2"}
def hello():
    print("Highlighted!")
```
:::{note}
Informational callout.
:::

:::{warning}
Important warning!
:::

:::{tip}
Helpful suggestion.
:::

How Content Flows

flowchart LR A[Markdown] --> B[MyST Parser] B --> C{Directive?} C -->|Yes| D[Render Component] C -->|No| E[Render HTML] D --> F[Final Page] E --> F

Variable Substitution

Use{{ variable }}syntax to insert frontmatter values directly into your content:

---
product_name: Bengal
version: 1.0.0
beta: true
---

Welcome to **{{ product_name }}** version {{ version }}.

{% if beta %}
:::{warning}
This is a beta release.
:::
{% end %}

Note

Bengal uses Kida templating which supports both{% end %} (unified syntax) and {% endif %}(Jinja-compatible). Use whichever you prefer.

Available Variables

Variable Source Example
Content Authoring Current page Content Authoring
Markdown, MyST directives, and rich content Current page Markdown, MyST directives, and rich content
{{ product_name }} Frontmatter Direct access to any frontmatter key
`` Frontmatter Hugo-style access viaparams
Bengal Site config Bengal
/bengal Site config /bengal

Cascaded Variables

Variables cascade from parent sections. Set them once in a section's_index.md:

# docs/api/_index.md
---
title: API Reference
cascade:
  api_version: v2
  deprecated: false
---

Then use in any child page:

# docs/api/users.md
This endpoint uses API {{ api_version }}.

Tip

Common use cases: Product names, version numbers, feature flags, environment-specific values, and cascaded metadata like API versions or status badges.

Available Directives

Bengal provides 60+ directives organized by category:

Category Directives
Admonitions note, tip, warning, danger, error, info, example, success, caution, seealso
Layout tabs, tab-set, cards, card, child-cards, grid, container, steps, step, dropdown
Tables list-table, data-table
Code code-tabs, literalinclude
Media youtube, vimeo, tiktok, video, audio, figure, gallery
Embeds gist, codepen, codesandbox, stackblitz, asciinema, spotify, soundcloud
Navigation breadcrumbs, siblings, prev-next, related
Versioning since, deprecated, changed
Utilities badge, button, icon, rubric, target, include, glossary, checklist, marimo

Seealso

In This Section

Notebooks Native Jupyter notebook support — drop .ipynb into content and build 4 pages
Code Blocks Add syntax-highlighted code with Rosettes, include files, configure themes, and create multi-language examples
External References Link to external documentation like Python stdlib, NumPy, and other Bengal sites
Images & Media Add images, figures, videos, and embeds to your content
Linking Guide Complete guide to creating links between pages, headings, and external resources
Math and LaTeX Inline and block mathematical expressions with LaTeX
Tables Create simple and complex tables using pipe syntax, list-table directive, and interactive data-tables