kyc

MDX Full Feature Example

KH

Kassem Hachi

Software Engineer · Published on February 18, 2025

5 min read

MDX: A Complete Example

MDX lets you combine Markdown, React components, and JS expressions in a single file.

Here’s an inline expression:
The result of 2 + 3 is 5.

Headings

This is a third-level heading

Normal paragraph text with italics, bold, and inline code.


Lists

Unordered list:

  • First item
  • Second item
    • Sub item
  • Third item

Ordered list:

  1. Step one
  2. Step two
  3. Step three

Task list:

  • Works?
  • Maybe?
  • Definitely not.

Custom Diagrams Example

Graph Diagram

Loading diagram...

Sequential Diagram

Loading diagram...

Flowchart Diagram

Loading diagram...

Images

Example Image

Example Image


Links

Next.js Documentation


Using JSX Components

Below is a custom JSX component imported at the top:

You can also pass expressions:


Tables

FeatureSupportedNotes
MarkdownWorks as usual
JSXAny React component
ExpressionsInline or blocks

Code Blocks

js
export function add(a, b) {
  return a + b;
}
console.log(add(2, 5));
jsx
function Greeting({ name }) {
  return <h1>Hello, {name}!</h1>;
}

Blockquote

MDX is powerful because it blends Markdown and React components.


MDX Expression Block

This is generated line 1

This is generated line 2

This is generated line 3


Footer

Thanks for reading! MDX is awesome 🚀

KH

Kassem Hachi

Software Engineer

relatedArticles

continueJourney

Explore More Content

Continue your learning journey

MDX Full Feature Example | Dutie