PrettifyPrettify

MDX Preview

Open an .mdx file and read it as a page. The Markdown renders, and each JSX component, such as a <Callout>, <Tabs>, or <Card />, shows as a labeled box with its props and its content. Edit the text in the Preview, and the imports and components keep their source.

Result
The formatted text shows here as you paste. Open the Preview to see it rendered and edit it.
Runs in your browser. Nothing is uploaded.

What the MDX preview does

Prettify does not have your component code, so it does not render your real components. Each component that stands alone in its paragraph shows as a box. The header gives its name and its props, and the children render as Markdown below.

This is enough to check the structure of a docs page: which content sits in which tab, card, or callout. The box does not change the document. The MDX that Prettify writes and copies is the same as your source.

Key features

The Preview is free and edits MDX in place, with no sign-up. It treats the Markdown and the JSX in separate ways, as the list below shows. Components show as boxes, and everything else stays as text.

  • A JSX element that fills its paragraph shows as a labeled box with its props.
  • Callout, Note, Info, Admonition, and Aside get an info color; Tip gets a tip color; Warning and Caution get a warning color; Danger gets a danger color.
  • A type or variant prop on those components, such as type="warning", picks the color.
  • Imports, exports, and expressions in braces stay as written and show as source.
  • Inline JSX in running text keeps its source look.
  • Frontmatter shows as a Properties card that you edit field by field.

How to use the MDX preview

Check the file in the box first, then open the Preview. The box formats the text, and the Preview shows the page with its component boxes, ready to edit.

  1. Paste your MDX into the box, or select Try an example.
  2. Read the line above the result. It gives the line count and the frontmatter keys.
  3. Select Open in Preview. The editor opens with the page rendered.
  4. Check each component box for its props and its children.
  5. Edit the text in the Preview, or switch to Raw to edit the MDX source.

Worked example: a page with a warning and tabs

This page imports one component, has a heading, and uses a <Callout> and a <Tabs> element. Paste it into the box, then select Open in Preview to see the boxes for yourself.

import { Callout } from '../components'

# Limits

<Callout type="warning">
  Uploads over 5 MB **fail**.
</Callout>

<Tabs>
  <Tab label="npm">
    Run `npm i`.
  </Tab>
</Tabs>

What the boxes show

The import line shows as source. The Callout shows as a box with the warning color, because its type prop is "warning". Its content renders as Markdown, so "fail" is bold.

The boxes are a view only. The MDX that you copy, or see in the Raw view, is your source, character for character.

The Tabs element shows as a box named Tabs. The Tab inside it shows as a nested box, and its header reads Tab label="npm". The inline code in the Tab keeps its code style.

Read-only cases

The Preview keeps your text exactly. It is read-only in two MDX cases: the file has a syntax error, or Prettier cannot format it without changing it. Fix a syntax error in the Raw view, and the Preview returns. A file of 200 KB or more also opens read-only.

Files, size, and Pro tools

Open .mdx files by paste, file picker, or drag and drop, or from Finder in the macOS app. Any file size opens in the Preview. Up to 200 KB it is editable, and a larger file shows a read-only Preview that loads as you scroll.

MDX shares the Markdown editor, so the same Pro tools apply: Side by side, the Outline of headings, Mermaid diagrams, and export to HTML or PDF.

Common use cases

A component box view suits people who review docs more than they write components. These are the jobs it fits best, and none of them needs your component code.

  • Check that a list is still inside its Callout after an edit.
  • See which content belongs to which Tab.
  • Review a docs page from a pull request without building the site.
  • Edit the prose in a page without touching its imports.
  • Spot a Callout whose type prop is wrong, because its color does not match the message.

Frequently asked questions

Does the MDX preview render my real components?

No. Prettify does not have your component code, so each component shows as a labeled box with its props and its content. Your Markdown renders as normal.

Can I edit MDX in the preview?

Yes. The Preview is an editor, and the imports, exports, and components keep their source text. A file the Preview cannot keep exactly opens read-only, and you edit it in the Raw view.

Why does my component not show as a box?

Only a JSX element that fills a paragraph on its own shows as a box. Inline JSX inside running text keeps its source look, and so do imports, exports, and expressions in braces.

Is the MDX preview free?

Yes. The Preview, component boxes, the Raw view, Prettier formatting, and the Properties card are free. Pro adds Side by side, the Outline, Mermaid diagrams, and export.

Which files can I open?

Files with the .mdx extension, by paste, file picker, or drag and drop. The macOS app also opens them from Finder. Markdown files (.md and .markdown) open in the same Preview.

Is my file uploaded to a server?

No. Parsing and rendering run in your browser, so your component names and unpublished pages stay on your device.

Related tools