Writing content
Standard Markdown, plus the handful of components docs actually need.
The file
A documentation page is an .mdx file under src/content/docs/, and its path is its URL: src/content/docs/webhooks.mdx is /webhooks/. Only .mdx files are loaded — a .md file there is silently ignored, with no build error. MDX is Markdown plus components, so everything you know about Markdown still applies.
Frontmatter
Only title is required. group and order place the page in the sidebar; omit group and the page still builds and is searchable — it just doesn’t appear in the nav.
| Key | Type | Default | Effect |
|---|---|---|---|
title |
string | — | Page heading, browser title, search result |
description |
string | — | The lede under the title, and the meta description |
group |
string | — | Sidebar group. No group means no sidebar entry |
order |
number | 0 |
Position within the group |
keywords |
string[] | — | Meta keywords |
image |
string | — | Social share image |
noindex |
boolean | false |
Keeps the page out of search engines and site search |
showTableOfContents |
boolean | true |
On-this-page rail |
showFeedback |
boolean | true |
The helpful vote at the foot of the page |
showCopyPage |
boolean | true |
The Copy page menu beside the title |
showPager |
boolean | true |
Previous/next links |
The “Updated” date beside each page’s title is not frontmatter — it is the file’s last commit, read when the site builds. Edit a page and the date follows.
Callouts
Four kinds. Use them for things a reader would otherwise learn the hard way.
Note
Context that helps, but isn't required to succeed.
Tip
A shortcut once the reader knows the basics.
Warning
Something that will surprise them if they skip it.
Danger
Data loss, irreversible actions, breaking changes.
<Alert
variant="warning"
title="Rotating a key revokes the old one"
text="Existing clients fail on the next request. Deploy the new key before rotating."
/>Code blocks
CodeBlock takes the sample, its language, a filename for the header bar and a line range to highlight. The sample goes in a fence between the tags, so it keeps its indentation exactly; leave the fence bare and put the language on CodeBlock.
<CodeBlock language="json" filename="src/data/theme.json" highlight="3" showCopy={true}>
```
…
```
</CodeBlock>{
"themeSelector": true,
"defaultTheme": "dark"
}Diffs
CodeDiff names its changed lines in added, removed and highlight, the same "2" or "1,4-6" form every code component uses. The code stays the literal sample, so it keeps its own language colors instead of going flat the way a diff fence does, and the copy button hands back something that runs.
{
"themeSelector": true,
"defaultTheme": "light",
"defaultTheme": "dark",
"theme": {
"accentLight": "#0f766e"
}
}Line numbers count the sample’s own lines, so they need a look after an edit that adds or removes one.
File trees
FileTree draws the connectors from an indented list of paths, so the tree stays editable as text. Any consistent indent unit works, and it takes the same added, removed and highlight line numbers as a diff — counting the rendered rows, so a blank line in the list doesn’t shift them.
src/
├─ components/
│ ├─ Button.astro
│ └─ Callout.astro
└─ styles/
└─ base.css
astro.config.mjsLanguage tabs
Use CodeTabs for one sample in several languages. The reader’s choice is remembered site-wide, so a Python developer stays in Python across every page.
curl https://api.acme.com/v1/invoices \
-H "Authorization: Bearer $ACME_KEY" \
-d customer=cus_8Kq2 \
-d amount=4900import { Acme } from '@acme/sdk'
const acme = new Acme(process.env.ACME_KEY)
const invoice = await acme.invoices.create({
customer: 'cus_8Kq2',
amount: 4900,
})from acme import Acme
acme = Acme(os.environ['ACME_KEY'])
invoice = acme.invoices.create(
customer='cus_8Kq2',
amount=4900,
)Code annotations
Notes sit under the block rather than in comments, so the snippet stays copy-paste clean. Each note names the line it marks.
{
"search": true,
"themeToggle": true,
"topbarLinks": [
{ "name": "GitHub", "path": "https://github.com/acme/docs" }
]
}Builds the search index at compile time and ships it with the site — no search service, no API key.
Links beside the brand. Add, remove and reorder them on the page in CloudCannon's Visual Editor.
Tables
Markdown tables get a bordered panel and horizontal scroll on narrow screens.
| Event | Retries | Payload |
|---|---|---|
invoice.paid |
5 | Invoice object |
user.created |
3 | User object |
plan.changed |
3 | Subscription delta |
Footnotes
Put a marker in the sentence and the note anywhere in the file. Notes collect at the foot of the page in marker order, each with a link back to where it was cited.1 Use them for an aside that would break the flow of a sentence, such as a source or an edge case.2
Retries back off exponentially.[^1]
[^1]: 1s, 2s, 4s, 8s, then 16s, with up to 20% jitter.Cross-links
Link by URL — [Configuration](/configuration/). npm run lint:links fails npm run check on an internal link that points at no page, so a renamed page can’t quietly rot. It also warns about orphan pages — a page with no sidebar group that no other page links to, which readers can only find through search.