# Markdown

The Markdown dialect Docsheaf reads and writes — CommonMark, GitHub tables and GitBook's Liquid tags.

Docsheaf stores pages as structured documents, and reads and writes them as Markdown wherever
files are involved: [Git Sync](git-sync), [import and export](import-and-export),
the `.md` version of every published page and `llms-full.txt`.

The dialect is the one GitBook uses: CommonMark, GitHub-flavored tables and task lists, and
Liquid-style tags for richer blocks. A file written for GitBook reads the same in Docsheaf.

## Front matter

A page file can start with YAML front matter. Docsheaf reads these keys:

| Key | Value | Effect |
| --- | --- | --- |
| `description` | Text | The line under the title. |
| `icon` | An emoji | The page's emoji. |
| `cover` | An image path or URL | The cover image. |
| `hidden` | `true` | Keeps the page out of navigation. |
| `noIndex` | `true` | Keeps the page out of search engines, the sitemap and llms.txt. |
| `date` | `YYYY-MM-DD` | The release date of a [changelog](changelogs) entry. |
| `tags` | `[a, b]` | Tags of a changelog entry or a knowledge base article. |
| `featured` | `true` | Features a [knowledge base](knowledge-bases) article on the home page. |
| `condition` | An expression | Shows the page only to readers who meet it. See [Adaptive content](adaptive-content). |

The first `# Heading` of the file is the page title.

```markdown
---
description: Deploy your app in under five minutes.
icon: 🚀
---

# Deploy

Your content…
```

## Block tags

| Block | Markdown |
| --- | --- |
| Hint | `{% hint style="info" %}…{% endhint %}` — `info`, `success`, `warning`, `danger` |
| Tabs | `{% tabs %}{% tab title="npm" %}…{% endtab %}{% endtabs %}` |
| Stepper | `{% stepper %}{% step %}…{% endstep %}{% endstepper %}` |
| Columns | `{% columns %}{% column width="50%" %}…{% endcolumn %}{% endcolumns %}` |
| Titled code | `{% code title="app.js" lineNumbers="true" overflow="wrap" %}` around a fenced block |
| Code group | `{% code-group %}…titled code blocks…{% endcode-group %}` |
| Expandable | `<details><summary>Title</summary>…</details>` |
| Embed | `{% embed url="https://…" %}` |
| File | `{% file src="report.pdf" %}Caption{% endfile %}` |
| Video | `{% video src="demo.mp4" %}Caption{% endvideo %}` |
| Page link | `{% content-ref url="page.md" %}[page.md](page.md){% endcontent-ref %}` |
| Subpages | `{% subpages %}` |
| Cards | `<table data-view="cards">` with hidden `data-card-target` and `data-card-cover` columns |
| Image | `![alt](image.png)` or `<figure><img src="…" alt="…"><figcaption>…</figcaption></figure>` |
| Math | `$$x^2$$` inline; `$$` on the lines around display TeX |
| Mermaid | A fenced code block with the language `mermaid` |
| OpenAPI | `{% openapi src="…" path="/pets" method="get" %}…{% endopenapi %}` |
| Conditional | `{% if visitor.claims.plan == "pro" %}…{% endif %}` |
| Snippet | `{% snippet id="snp_…" %}` (Docsheaf's own tag) |

## Inline

| Element | Markdown |
| --- | --- |
| Bold, italic, strikethrough | `**bold**`, `_italic_`, `~~strike~~` |
| Underline | `<u>underline</u>` |
| Inline code | `` `code` `` |
| Button | `<a href="quickstart.md" class="button primary">Get started</a>` (`primary` or `secondary`) |
| Badge | `<span class="badge" data-tone="success">New</span>` |
| Footnote | `Text[^1]` and, at the end, `[^1]: The note.` |

## Links between pages

Link to another page by its file, relative to the current file: `[Deploy](../guides/deploy.md#step-2)`.
Docsheaf turns these into page links on import and back into file paths on export, so they keep
working on both sides — including after pages move.
