pluginMdx

pluginSsg に MDX・Markdown のファイルを対応させるプラグイン。

Table of Contents

How To Use

./minista.config.js
import { pluginMdx } from "minista"

export default {
  plugins: [pluginMdx()],
}
./src/pages/index.mdx
# heading

## heading2

paragraph

Options

Default
pluginMdx({
  remarkPlugins: [],
  rehypePlugins: [],
})

オプションは @mdx-js/rollup の Options と同一です。

remarkPlugins に remark-frontmatter または remark-mdx-frontmatter を用いると、デフォルトの設定を上書きできます。

Frontmatter

フロントマターは props として Layout や Page で使用可能です。drafttrue にしたページは本番ビルドから除外されます。

./src/pages/index.mdx
---
title: Index
draft: false // true = Don't build the page
---

# {props.title}

Component

MDX・Markdown のファイルはレイアウトテンプレートやページテンプレート内でコンポーネントとして使用できます。

./src/pages/index.jsx
import Content from "./index.mdx"

export default function () {
  return <Content />
}