Skip to navigation
1 minute read
By Titus Wormer

GitHub flavored markdown (GFM)

This guide explores how to support GFM features such as autolink literals, footnotes, strikethrough, tables, and task lists. MDX supports standard markdown syntax (CommonMark). That means GitHub flavored markdown (GFM) extensions are not supported by default. They can be enabled by using a remark plugin: remark-gfm. Such plugins can be passed in options.remarkPlugins. More info on plugins is available in § Extending MDX

Say we have an MDX file like this:


## Autolink literals,, and

## Footnote

A note[^1]

[^1]: Big note.

## Strikethrough

~one~ or ~~two~~ tildes.

## Table

| a | b  |  c |  d  |
| - | :- | -: | :-: |

## Tasklist

* [ ] to do
* [x] done

The above MDX with GFM can be transformed with the following module:

import fs from 'node:fs/promises'
import {compile} from '@mdx-js/mdx'
import remarkGfm from 'remark-gfm'

    await compile(await fs.readFile('example.mdx'), {remarkPlugins: [remarkGfm]})
Expand equivalent JSX
  <h2>Autolink literals</h2>
    <a href=""></a>,
    <a href=""></a>, and
    <a href=""></a>.
  <p>A note<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref aria-describedby="footnote-label">1</a></sup></p>
    <del>one</del> or <del>two</del> tildes.
        <th align="left">b</th>
        <th align="right">c</th>
        <th align="center">d</th>
  <ul className="contains-task-list">
    <li className="task-list-item">
      <input type="checkbox" disabled /> to do
    <li className="task-list-item">
      <input type="checkbox" checked disabled /> done
  <section data-footnotes className="footnotes">
  <h2 id="footnote-label" className="sr-only">Footnotes</h2>
    <li id="user-content-fn-1">
        Big note.
        <a href="#user-content-fnref-1" data-footnote-backref className="data-footnote-backref" aria-label="Back to content">↩</a>