Sabertaz Blog

Search posts and tags

Search for posts by title or tags

Implement Fancy MDX

Implement Fancy MDX in Next.js

Implement Fancy MDX

Fancy MDX

All your .md and .mdx files under the contents directory will be rendered with MDX, it's an advanced Markdown format with React component support.

Heading

Renders:

Hello, This Is a Title Inside h1

Hello, This Is a Title Inside h2

Hello, This Is a very very very very very very very very very long Title Inside h2

Hello, This Is a Title Inside h3

Hello, This Is a very very very very very very very very very long Title Inside h3

Hello, This Is a Title Inside h4

Hello, This Is a Title Inside h5
Hello, This Is a Title Inside h6

List

Unordered List

Renders:

  • Create a list by starting a line with +, -, or *.
  • Sub-lists are made by indenting 2 spaces:
    • Marker character change forces new list start:
      • Ac tristique libero volutpat at.
      • Facilisis in pretium nisl aliquet.
      • Nulla volutpat aliquam velit.
  • Very easy!

Ordered List

Sequential numbering:

Renders:

  1. Lorem ipsum dolor sit amet:
    1. Lorem ipsum dolor sit amet:
      1. Lorem ipsum dolor sit amet.
      2. Consectetur adipiscing elit.
      3. Integer molestie lorem at massa.
    2. Consectetur adipiscing elit:
      1. Lorem ipsum dolor sit amet.
    3. Integer molestie lorem at massa:
      1. Lorem ipsum dolor sit amet.
      2. Consectetur adipiscing elit.
  2. Consectetur adipiscing elit:
    1. Lorem ipsum dolor sit amet:
      1. Lorem ipsum dolor sit amet.
      2. Consectetur adipiscing elit.
    2. Consectetur adipiscing elit:
      1. Lorem ipsum dolor sit amet.
      2. Consectetur adipiscing elit.
      3. Integer molestie lorem at massa.
  3. Integer molestie lorem at massa:
    1. Lorem ipsum dolor sit amet.
    2. Consectetur adipiscing elit.
    3. Integer molestie lorem at massa.

Same numbering:

Renders:

  1. You can keep all the numbers as 1.:
    1. Lorem ipsum dolor sit amet:
      1. Lorem ipsum dolor sit amet.
      2. Lorem ipsum dolor sit amet.
      3. Lorem ipsum dolor sit amet.
    2. Lorem ipsum dolor sit amet:
      1. Lorem ipsum dolor sit amet.
    3. Lorem ipsum dolor sit amet:
      1. Lorem ipsum dolor sit amet.
      2. Lorem ipsum dolor sit amet.
  2. Lorem ipsum dolor sit amet:
    1. Lorem ipsum dolor sit amet.
    2. Lorem ipsum dolor sit amet.
    3. Lorem ipsum dolor sit amet.

Start numbering with offset:

Renders:

  1. 108 numbering list.
  2. 1 numbering list.
  3. 1 numbering list.

Task List

Renders:

  • Write the press release.
  • Update the website.
  • Contact the media.

Horizontal Rule

Renders:


Renders:


Renders:


Emphasis

Bold

Renders:

This is bold text.

This is bold text.

Italic

Renders:

This is italic text.

This is italic text.

Strikethrough

Renders:

This is strikethrough text.

This is strikethrough text.

Blockquote

Nested Blockquote

Renders:

Blockquotes can also be nested...

...by using additional greater-than signs right next to each other...

...or with spaces between arrows.

Continued Blockquote

Renders:

Blockquotes can also be continued... ...continued... ...continued continued...

Long Blockquote

Renders:

Blockquotes can be very very very very very very very very long...very very very very very very very very long...very very very very very very very very long...very very very very very very very very long...very very very very very very very very long...very very very very very very very very long...very very very very very very very very long...very very very very very very very very long...very very very very very very very very long...

Table

Basic Table

abcd
10200360048000
20010480003600
36004800010200
48000360020010
OptionDescription
datapath to data files to supply the data that will be passed into templates.
engineengine to be used for processing templates. Handlebars is the default.
extextension to be used for dest files.

Left Aligned Table

OptionDescription
datapath to data files to supply the data that will be passed into templates.
engineengine to be used for processing templates. Handlebars is the default.
extextension to be used for dest files.

Center Aligned Table

OptionDescription
datapath to data files to supply the data that will be passed into templates.
engineengine to be used for processing templates. Handlebars is the default.
extextension to be used for dest files.

Right Aligned Table

OptionDescription
datapath to data files to supply the data that will be passed into templates.
engineengine to be used for processing templates. Handlebars is the default.
extextension to be used for dest files.

Code

Inline code.

Block code "fences":

Syntax highlighting:

Renders:

Link text.

Link with title.

Auto-converted link:

Footnote

Renders (footnote renders at the end of the document):

A note1.

Another note2.

Yet another note3.

Image

Local Image

Renders:

No Image AvailableLocal image

Remote Image

Renders:

No Image AvailableMinion

Error Image

Renders:

No Image AvailableError image

Image Title

Renders:

No Image AvailableStormtroopocatThe Stormtroopocat

Image Footnote

Like links, Images also have a footnote style syntax:

With a reference later in the document defining the URL location:

Renders:

No Image AvailableAlt textThe Dojocat

JSX

JSX Element

Renders:

JSX Heading 2

HTML is a lovely language.

And here is markdown in JSX!
# this is not a heading but this is emphasis

I can write Markdown alongside my JSX!

This is a p.

JavaScript Expression

Renders:

Two 🍰 is: 6.283185307179586.

Renders:

Who would have guessed?!

MDX Comment

Renders nothing.

Git

Emoji

Thumbs up :+1: 👍, thumbs down :-1: 👎.

Families :family_man_man_boy_boy: 👨‍👨‍👦‍👦.

Some flags :cn:, :us:, :ru:, :uk:, :fr: 🇨🇳, 🇺🇸, 🇷🇺, 🇬🇧, 🇫🇷.

Tada :tada: 🎉, sparkles :sparkles: , rocket :rocket: 🚀.

Bug :bug: 🐛, wrench :wrench: 🔧, zap :zap: .

Math

Inline Math Formula

This is a math formula $\sqrt{a^2 + b^2}$ a2+b2\sqrt{a^2 + b^2}.

This is another math formula $c = \pm\sqrt{a^2 + b^2}$ c=±a2+b2c = \pm\sqrt{a^2 + b^2}.

Block Math Formula

L=12ρv2SCLL = \frac{1}{2} \rho v^2 S C_L abcdefghi\def\arraystretch{1.5} \begin{array}{c:c:c} a & b & c \\ \hline d & e & f \\ \hdashline g & h & i \end{array} a=b+c=e+f\begin{equation} \begin{split} a &= b + c \\ &= e + f \end{split} \end{equation} a=b+cd+e=f\begin{align} a &= b + c \\ d + e &= f \end{align} 10x+3y=23x+13y=4\begin{alignat}{2} 10 &x + &3 &y = 2 \\ 3 &x + &13 &y = 4 \end{alignat}

Admonition

Green Admonition

Renders:

Blue Admonition

Renders:

Yellow Admonition

Renders:

Red Admonition

Renders:

Title Admonition

Renders:

Renders:

Nested Admonition

Renders:

MDX Component

Renders:


Renders:


Renders:

Footnotes

  1. Big note.

  2. Small note.

  3. Smallest note.