Astro Markdown supports far more than basic formatting out of the box: GitHub-flavored tables, task lists and footnotes, automatic heading IDs, Shiki syntax highlighting with light and dark themes, optimized local images, smart punctuation, and a headings list you can turn into a table of contents. In Astro 7, the default Sätteri processor also has opt-in features such as directives, math, heading attributes and definition lists that used to need remark plugins.
This list covers twelve Astro Markdown features worth using, what each one needs, and the config to switch on the ones that are off by default.
Key Takeaways
- GFM (tables, task lists, strikethrough, footnotes) and smart punctuation are on by default.
- Every heading gets an
id, andrender()returns aheadingsarray for tables of contents.- Relative images in Markdown are optimized like
<Image />.- Sätteri, the Astro 7 default processor, can enable directives, math, heading attributes and more with a flag.
- Plugins now go through
markdown.processor; the top-levelremarkPluginsoption is deprecated.
How Markdown works in Astro 7
Astro renders .md files in three places: content collections loaded with glob(), pages in src/pages/, and files you import directly. In Astro 7 the default renderer is Sätteri, Astro’s native Markdown pipeline. Your existing Markdown renders the same way; what changed is how you configure it.
The older top-level options (markdown.remarkPlugins, markdown.rehypePlugins, markdown.gfm and markdown.smartypants) still work but are deprecated. Configuration now goes through markdown.processor:
// astro.config.mjs
import { defineConfig } from 'astro/config';
import { satteri } from '@astrojs/markdown-satteri';
export default defineConfig({
markdown: {
processor: satteri({
features: {
directive: true,
headingAttributes: true,
},
}),
},
});
If you depend on remark or rehype plugins, install @astrojs/markdown-remark and use processor: unified({ remarkPlugins: [...] }) instead. MDX inherits plugins configured that way. For most of the features below you need neither.
1. GitHub-flavored Markdown
Tables, task lists, strikethrough, autolinked URLs and footnotes all work with no setup:
<!-- src/content/blog/release-notes.md -->
| Version | Status |
|---|---|
| 7.4 | Current |
| 6.x | Maintenance |
- [x] Update dependencies
- [ ] Run the build
~~Deprecated API~~ replaced in 7.0.[^1]
[^1]: See the upgrade guide for details.
Footnotes render as a numbered list at the end of the page, with back-links. They suit long technical articles where an aside would break the flow.
2. Smart punctuation
Straight quotes become curly quotes, -- becomes an en dash, and ... becomes an ellipsis. It is on by default in Astro. If you write about code and want literal characters in prose, turn it off with features: { smartPunctuation: false } in satteri(). Code blocks and inline code are never changed.
3. Automatic heading IDs
Every heading gets a slug id, so ## Getting started renders as <h2 id="getting-started">. You can link to any section with #getting-started without writing anchors by hand. That is also what search engines use for “jump to” links in results.
4. A headings list for tables of contents
When you render a collection entry, Astro returns the headings alongside the content:
---
// src/pages/blog/[id].astro
import { getCollection, render } from 'astro:content';
export async function getStaticPaths() {
const posts = await getCollection('blog');
return posts.map((post) => ({ params: { id: post.id }, props: { post } }));
}
const { post } = Astro.props;
const { Content, headings } = await render(post);
const toc = headings.filter((h) => h.depth === 2 || h.depth === 3);
---
<nav aria-label="On this page">
<ul>
{toc.map((h) => (
<li class={`depth-${h.depth}`}><a href={`#${h.slug}`}>{h.text}</a></li>
))}
</ul>
</nav>
<article><Content /></article>
Each heading has depth, slug and text. The table of contents tip builds this into a reusable component with nesting.
5. Syntax highlighting with Shiki
Fenced code blocks are highlighted at build time with Shiki, so no highlighting JavaScript ships to the browser. Change the theme, or use one theme for light mode and another for dark:
// astro.config.mjs
import { defineConfig } from 'astro/config';
export default defineConfig({
markdown: {
shikiConfig: {
themes: { light: 'github-light', dark: 'github-dark' },
wrap: true,
},
},
});
With dual themes, Shiki writes both colors as CSS variables, and a few lines of CSS switch them when your site is in dark mode. wrap: true wraps long lines instead of scrolling. Prefer Prism? Set syntaxHighlight: 'prism' and add a Prism stylesheet.
6. Leaving some languages unhighlighted
Diagram tools such as Mermaid read the raw text of a code block. If Shiki highlights it first, the diagram script gets HTML spans instead of text. Exclude those languages:
// astro.config.mjs
export default defineConfig({
markdown: {
syntaxHighlight: {
type: 'shiki',
excludeLangs: ['mermaid', 'math'],
},
},
});
The default already excludes math. Add any language a client-side tool needs to read as plain text.
7. Optimized images in Markdown
A relative image in Markdown is processed by astro:assets, the same pipeline as the <Image /> component:
<!-- src/content/blog/launch/index.md -->

Astro converts it to WebP, sets width and height to prevent layout shift, and adds loading="lazy". Images in public/ () are served as-is. Keep post images next to the post and reference them relatively. The Astro image component guide covers remote image rules that also apply here.
8. Directives for callouts and asides
With directive: true, Sätteri parses colon-delimited container blocks:
<!-- src/content/docs/install.md -->
:::note
Astro 7 requires Node.js 22.12 or later (22.23.4 or later from 7.4.2).
:::
The block becomes a node your processor plugins can turn into any HTML, such as an <aside class="note">. This gives Markdown authors callouts without switching the file to MDX. Starlight uses the same syntax for its asides.
9. Heading attributes
With headingAttributes: true, you can set a heading’s id or class directly:
## Install the CLI { #install }
## Changelog { .visually-hidden }
Custom IDs keep links stable when you reword a heading. Without this, changing “Install the CLI” to “Installing the CLI” changes the slug and breaks every link to the old anchor.
10. Math, sub, superscript and definition lists
A few more opt-in features help technical and reference content:
math: trueparses$inline$and$$block$$math so a math renderer can typeset it.superscript: trueandsubscript: trueenable^2^and~2~, handy for units and chemistry.definitionList: trueturns a term followed by a line starting with:into a<dl>, which suits glossaries.
All are off by default, so turning them on does not change existing content unless it already uses that syntax.
11. Frontmatter, validated
YAML frontmatter (and TOML with +++ fences) is parsed for every file. In a content collection, a Zod schema validates it at build time, so a typo in a date or a missing title fails the build instead of shipping:
// src/content.config.ts
import { defineCollection } from 'astro:content';
import { glob } from 'astro/loaders';
import { z } from 'astro/zod';
const blog = defineCollection({
loader: glob({ pattern: '**/*.md', base: './src/content/blog' }),
schema: z.object({
title: z.string().max(70),
pubDate: z.coerce.date(),
draft: z.boolean().default(false),
tags: z.array(z.string()).default([]),
}),
});
export const collections = { blog };
The Content Collections guide and the content docs cover schemas, references and loaders.
12. The Code component for code outside Markdown
The same Shiki highlighting is available in .astro files through the built-in <Code /> component, useful for code examples that live in data or props:
---
// src/components/Snippet.astro
import { Code } from 'astro:components';
const example = `npx astro add sitemap`;
---
<Code code={example} lang="bash" theme="github-dark" />
It renders at build time with zero client JavaScript, just like highlighted Markdown.
When to switch to MDX
Plain Markdown covers most writing. Reach for MDX when a page needs real components: an interactive demo, a pricing table component, or a tabbed code example. MDX adds JSX parsing, which makes stray { and < characters in prose a syntax error, so keep files as .md unless they need components. The Astro MDX guide explains the trade-off and the setup, and the official Markdown guide on docs.astro.build lists every processor option.
Blog and editorial sites lean on these features the most. If you are starting one, the Astro blog and editorial themes already have collection schemas, tables of contents and code styling wired up.
FAQ
Does Astro support GitHub-flavored Markdown?
Yes. Tables, task lists, strikethrough, autolinks and footnotes work by default in .md and .mdx files. You can turn GFM off with features: { gfm: false } in the satteri() processor.
How do I add remark plugins in Astro 7?
Install @astrojs/markdown-remark and set markdown: { processor: unified({ remarkPlugins: [yourPlugin] }) } in astro.config.mjs. The top-level markdown.remarkPlugins option is deprecated, and MDX inherits plugins set through unified().
How do I get the headings of a Markdown file in Astro?
Call render(entry) from astro:content and read the returned headings array. Each item has depth, slug and text. For a directly imported .md file, call its getHeadings() export.
Are images in Astro Markdown optimized?
Relative images such as  are optimized, resized and given dimensions. Images referenced from public/ with an absolute path are served without changes.
What is Sätteri in Astro?
Sätteri is Astro’s native Markdown processor and the default for .md files in Astro 7. It handles GFM, frontmatter and highlighting itself, and has opt-in features such as directives, math and heading attributes.