0.4.4 • Published 3 years ago

next-mdx-builder v0.4.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

next-mdx-builder

Next.js plugin that adds MDX pages support via next-mdx-remote & a custom Webpack plugin.

Install

yarn add next-mdx-builder
npm i --save next-mdx-builder

API Reference

type PluginOptions = SerializeOptions;

SerializeOptions: https://github.com/hashicorp/next-mdx-remote/blob/main/src/types.ts#L2

Usage

Plugin

Add and configure plugin in next.config.js:

// next.config.js
const withMdxBuilder = require("next-mdx-builder")({
  mdxOptions: {
    remarkPlugins: [require("remark-gfm")],
    rehypePlugins: [require("mdx-prism")],
  },
});

module.exports = withMdxBuilder(/** Next Config */ {});

pages

Directory tree:

- layouts/
    - docs.jsx
- pages/
    - docs/
        - introduction.mdx

MDX (pages/docs/introduction.mdx):

---
title: Introduction
layout: "../../layouts/docs"
---

# Docs Introduction Page

Layout:

export default function DocsPage({ children, frontMatter }) {
  return (
    <>
      <h1>{frontMatter.title}</h1>
      {children}
    </>
  );
}

Acknowledgements

0.4.4

3 years ago

0.5.0

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago