Академия ПроМастерства

Authoring in MDX

Опубликовано 11 авг. 2026 г.1 мин чтенияНачальный
300просмотров

TL;DR

Why MDX

Plain Markdown is great for prose but can't express callouts, step lists or comparison tables. MDX lets you drop in components exactly where you need them.

Whitelist

Only components on the sanitizer whitelist may appear in MDX. This keeps authored content safe to render.

Adding a block

tsx
// 1. Create the component, 2. register it in components/mdx-blocks/index.ts,
// 3. add its name to the sanitizer whitelist.
export function Highlight({ children }: { children: React.ReactNode }) {
  return <mark className="bg-accent-soft">{children}</mark>
}
Был ли этот гайд полезен?
Автор
Ada Lovelace
Demo author

A placeholder author for the Stateinik demo. Replace with your own in the admin.

Тема
Welcome to Stateinik
Основная статья темы
Похожие статьи

Похожие гайды