bjoerge / parcel-transformer-mdx-with-toc

An experimental Parcel v2 plugin for MDX that also exports the table of contents

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

parcel-transformer-mdx-with-toc

An experimental Parcel v2 plugin for MDX that also exports Table of Contents using markdown-toc and github-slugger to generate anchor names for headings.

Note: This plugin is based on the official [parcel-plugin-mdx][] and modified to also export the Table of Contents. If you don't need a Table of Contents, you are better off using the official @parcel/transformer-mdx.

Installation

npm:

npm i -D parcel-transformer-mdx-with-toc

Or with Yarn:

yarn add -D parcel-transformer-mdx-with-toc

Add as transform to .parcelrc

{
  "extends": ["@parcel/config-default"],
  "transforms": {
    "*.{md,mdx}": ["parcel-transformer-mdx-with-toc"]
  }
}

Usage

// index.js
import MDXContent, {Toc} from './content.mdx';
...

render(<><Toc /><MDXContent /></>, root);

License

MIT

About

An experimental Parcel v2 plugin for MDX that also exports the table of contents

License:MIT License


Languages

Language:JavaScript 100.0%