MDX
MDX adds imports and components to a Markdown document. It keeps the same math, diagram and code pipeline as ordinary Markdown. This page imports only an Astro component and does not hydrate React.
Component composition
An Astro component can appear inside MDX without installing a client framework.
Formulas
The same configured macro renders in MDX: and .
A long expression remains within its own scrolling region:
Diagrams
sequenceDiagram
participant Author
participant Build
participant Reader
Author->>Build: Markdown or MDX
Build->>Reader: Static content
Reader->>Reader: Render diagrams when present
An invalid graph also preserves its source in MDX:
flowchart LR
A[Unclosed label --> B
Highlighted code
---
import Notice from '@tcitry/astro-book/components/Notice';
---
<Notice>Framework-neutral content component</Notice>
Wide tables
| Format | Formula rendering | Diagrams | Highlighting | Framework requirement |
|---|---|---|---|---|
| Markdown | Build-time KaTeX with shared macros | Lazy runtime with source fallback | Shared light/dark Shiki configuration | None |
| MDX | Build-time KaTeX with the same shared macros | The same lazy runtime and source fallback | The same light/dark Shiki configuration | None for Astro components |
Native HTML
MDX native HTML
MDX uses JSX syntax for HTML and retains the same reading styles.
Image zoom
Click this synthetic, locally bundled SVG to open the theme image viewer.