Gå til hovedinnhold

MDX format (.mdx)

The MDX format reads .mdx files — CommonMark Markdown extended with JSX components, ESM import/export statements, and {expression} braces — the authoring format of modern documentation and content sites (Docusaurus, Next.js, Astro).

Translatable Markdown prose is extracted using the same machinery and configuration as the Markdown format (paragraphs, headings, list items, link/image text, inline emphasis). MDX-specific constructs — ESM statements, JSX tags with their attributes and children, top-level {expression} blocks, and GFM tables — are preserved byte-for-byte and never translated, with component names, attribute values, import paths, and expressions left untouched. Read→write reproduces real-world .mdx exactly when nothing is translated; the reader self-verifies each prose region and falls back to opaque preservation if a region would not round-trip byte-faithfully.

IDmdx
SourceBuilt-in
Extensions.mdx
MIME Typestext/mdx
CapabilitiesRead + Write

Parameters

ParameterTypeDefaultDescription
codeFinderRulesarrayRegex patterns that match inline codes within translatable text.
frontMatterKeysarrayFront matter keys to extract when translateFrontMatter is on (empty = every scalar value). Set the prose-bearing keys, e.g. title and description.
translateBlockQuotesbooleantrueIf true, blockquote content is translatable.
translateCodeBlocksbooleanfalseIf true, fenced and indented code blocks are translatable. If false, emitted as non-translatable data.
translateFrontMatterbooleanfalseIf true, YAML front matter values are translatable. If false, emitted as non-translatable data.
translateHTMLBlocksbooleanfalseIf true, raw HTML blocks are translatable. If false, emitted as non-translatable data.
translateImageAltbooleantrueIf true, image alt text is included in translatable content.
translateURLsbooleanfalseIf true, link and image URLs are translatable.
useCodeFinderbooleanfalseEnable regex-based inline code detection within translatable text.

Configure these parameters interactively and copy the YAML on the Format Reference.

Processing notes

  • Markdown prose is translatable; ESM, JSX (including children, in this version), expressions, and GFM tables are opaque and preserved verbatim.

  • Configuration parameters mirror the Markdown format (e.g. frontmatter and code-block handling).

  • Detection is by the unique .mdx extension.

← Back to the Format Reference