mdxblogdemo

MDX Kitchen Sink

A tour of the MDX blog features: headings, code, images, tables, diagrams, and links.

F0RR02 min read209 wordsUpdated Feb 10, 2025

Table of contents

Quickstart

Create a folder, add page.mdx, and drop assets next to it.

  1. src/content/blog/my-post/page.mdx
  2. src/content/blog/my-post/opengraph-image.png
  3. Add opengraph-image.png next to the post

Tip: keep draft: true until you are ready to publish.

Code blocks

Use fenced blocks with a language for syntax highlighting.

type Post = {
  title: string;
  date: string;
};
 
const posts: Post[] = [
  { title: "Hello", date: "2025-01-01" },
];

Inline code like next.config.ts is styled too.

Images

Markdown images work with relative paths:

Inline image

You can also use the MDX <Image /> component for optimized images:

Inline preview

Tables

GFM tables are enabled:

FeatureSupport
GFM tablesYes
Syntax highlightingYes
Mermaid diagramsYes

Mermaid diagrams

Use mermaid fenced blocks for diagrams:

flowchart LR
  Idea --> Sketch --> Prototype --> Ship

Internal links stay client-side: Blog index

External links open in a new tab: Next.js

Footnotes

Here is a footnote reference.1

Footnotes

  1. Footnotes are provided by remark-gfm.