Fumadocs Editor

Syntax

Dialects, feature switches and the verbatim fallback

Two props decide what the editor understands:

  • components: the component specs
  • syntax: switches for Markdown dialects

JSX without a spec keeps its children editable, with its tags edited as text. Anything else is kept verbatim: it round-trips byte-for-byte and is edited as source. Turning a feature off never breaks a document.

editor.tsx
import {
  MdxEditor,
  admonitionSpec,
  filesFenceSpecs,
  fumadocsUiComponents,
} from "@fumadocs-editor/ui";

const components = [...fumadocsUiComponents, admonitionSpec, ...filesFenceSpecs];

export function DialectEditor({ text }: { text: string }) {
  return <MdxEditor defaultValue={text} components={components} syntax={{ math: true }} />;
}

Options

OptionDefaultTurns on
headingSuffixestrue[#id] and [!toc] on headings
mathfalse$…$ and $$…$$ TeX math
directivestrue with admonitionSpec::: admonitions

Dialects are off by default because they change how existing text parses: with math on, $5 and $10 becomes a formula.

Dialects

Not yet editable

Explicit <CodeBlockTabs>, non-fumadocs <Tabs> and footnotes are kept verbatim for now.

Last updated on

On this page