Browse documentation
Docs/Markdown Toolkit/The Markdown macro

The Markdown macro

Write Markdown on a Confluence page, with Mermaid diagrams, KaTeX maths and highlighted code.

What it does. Renders Markdown you type into a block on the page. Insert it by typing /Markdown.

When to use it. For content that is written in Markdown by the people who own it: runbooks kept next to code, architecture notes, generated documentation. It stays Markdown instead of being rewritten into the Confluence editor — and the diagrams inside it stay text, which is the part that pays off six months later.

The macro has two modes: Write, where you type or paste, and Preview, which shows exactly what the page will render.

Confluence page → /Markdown macro → WriteIllustration
WritePreview
## Deploy flow

> [!NOTE]
> Requires the release checklist to be complete.

```mermaid
graph LR
  A[PR merged] --> B[CI]
  B --> C{Tests pass?}
  C -->|yes| D[Deploy staging]
  C -->|no| E[Block]
```

| Stage | Owner | SLA |
|-------|-------|-----|
| CI    | Platform | 10 min |
| Staging | Release | 30 min |

Error budget: $1 - \frac{failures}{requests}$
PreviewCancel

What it renders

You writeYou get
Standard and GitHub-flavoured MarkdownHeadings, emphasis, lists, task lists, links, images, quotes and tables.
A fenced code block with a languageA code block with syntax highlighting, via highlight.js.
A fenced mermaid blockA rendered diagram. Twenty-one types, from a flowchart to a Gantt chart to a C4 context diagram — see the gallery.
$…$ or $$…$$Maths, typeset with KaTeX.
> [!NOTE], > [!WARNING]Coloured panels.
Confluence page → Markdown macro (rendered)Illustration

Deploy flow

Note
Requires the release checklist to be complete.
PR mergedCITests pass?Deploy stagingBlock
StageOwnerSLA
CIPlatform10 min
StagingRelease30 min
Error budget: 1 − failures / requests (rendered with KaTeX)
The same macro content, rendered on the page.

A diagram, in eleven lines

One more example of the row above, rendered here by the same library the macro runs. It is a decision tree out of a runbook — the kind of thing that normally arrives as a screenshot nobody can correct.

```mermaid · flowchartExample
Eleven lines of Markdown. Editable by anyone who can edit the paragraph above it, and it leaves a Markdown export as the same eleven lines.

Maths, on the page

The $$…$$ block below is from the app's own architecture note, where it costs an export job. It is typed as LaTeX and typeset by KaTeX in the browser — no image, no external service.

KaTeX · in the macroExample
The total time of an export is dominated by I/O, not by conversion: $$ T_{total} = \sum_{i=1}^{n} \left( t_{fetch}(p_i) + t_{conv}(p_i) \right) + \left\lceil \frac{B}{184320} \right\rceil \cdot t_{kvs} $$ where $n$ is the number of pages and $B$ the total bytes of attachments.
Typeset in your browser as you read this, from the same delimiters the macro reads. Open Show source for the LaTeX behind it.

Sizing a diagram

Each macro carries its own layout settings, because a sequence diagram and a pie chart do not want the same treatment.

Width
Natural keeps the diagram's own width and scrolls inside the block — the default, and the right answer for anything wide. Fit shrinks it to the column. A number caps it at that many pixels.
Max height
Caps the block and scrolls inside it. Useful for a long Gantt chart you do not want owning the whole page.
Alignment
Left by default. A diagram is only centred when it actually fits: centring something wider than the column pushes its left edge out of reach.
Diagrams as text beat diagrams as images
A Mermaid diagram in a macro can be edited by anyone who can edit the page, and it survives a Markdown export as its original source. An exported PNG cannot be corrected without the tool that made it, and that tool is usually on somebody's old laptop.
Where macro content lives
Not with the app. The Markdown you type is Forge macro configuration, which Confluence keeps inside the page itself — the same place a built-in macro's settings live. So it survives an uninstall, it is in the page history, and it goes with the page when the page is deleted. What an uninstall takes away is the rendering: without the app the macro has nothing to draw it, so the page shows an unrendered placeholder until the app is installed again. See the privacy policy.

Something missing or wrong on this page? Tell us in the support portal or email contact@synapseoasis.com.