What is MDX?
MDX is Markdown extended to allow JSX expressions and components inline. A .mdx file is parsed as Markdown — headings, paragraphs, lists, fenced code blocks, links — but anything that looks like JSX (<MyComponent />, <Tabs><Tab>...</Tab></Tabs>, or expression curlies {value}) is parsed as JSX and rendered as a React (or Vue, with mdx-vue) component. MDX powers documentation sites built with Next.js, Docusaurus, Astro, Gatsby, and Storybook docs.
How is JSX inside Markdown handled?
The formatter walks the file line by line. Markdown lines (headings, paragraphs, lists, code fences) are preserved verbatim — MDX is whitespace-sensitive at the markdown layer (a blank line ends a paragraph, indented code blocks need 4 spaces) and reformatting prose would break rendering. JSX blocks at the top level — those starting with a capitalised tag like <Counter ...> — are detected, the matching close tag is found, and the block is reindented with one element per line.
Will it modify my Markdown headings, lists, or code fences?
No. Markdown lines are emitted unchanged (with trailing whitespace trimmed). Heading levels (#, ##, ###), list markers (-, *, 1.), code fence languages (```ts), inline emphasis (**bold**, *italic*, `code`), and link syntax ([text](url)) all round-trip exactly as you pasted them.
Does it work with Next.js, Docusaurus, and Astro MDX?
Yes — these all use the same upstream MDX parser (mdxjs.com), so the file format is identical. The differences are which components are auto-imported (Next.js MDX needs explicit imports or an mdx-components.tsx file; Docusaurus auto-injects Tabs/TabItem/Admonition; Astro lets you mix .astro components alongside React). The formatter does not need to know about your component library — it formats whatever JSX is present.
Will it preserve frontmatter (YAML at the top of the file)?
Yes. Frontmatter delimited by --- at the start of an MDX file (title:, description:, tags:, layout:) is treated as Markdown content and emitted verbatim. The formatter never modifies the frontmatter block; it only reformats JSX appearing later in the document.
How are JSX expressions like {value} or {variable.prop} handled?
Inline expression braces like {count} or {user.name} embedded in prose are preserved as part of the Markdown text — the formatter does not touch them. Block-level expression braces ({/* JSX comment */} on its own line, or a {array.map(...)} block) are similarly preserved verbatim.
Is the MDX I paste sent to your servers?
No. Formatting runs entirely in your browser using JavaScript. Documentation drafts containing internal API names, unreleased feature descriptions, or customer-specific examples never leave the device. Open DevTools → Network and click Format to verify no requests are made.
How is this different from Prettier with the MDX plugin?
Prettier with the MDX plugin parses the file with the official MDX parser and re-prints both the Markdown (using its prose-wrap, list-marker, and emphasis-marker rules) and the JSX (using its JSX printer). This online tool is lighter — it preserves Markdown lines verbatim and only reindents JSX blocks. For project-wide enforcement use Prettier; for a one-off readability fix on a docs file use this tool.