docusaurus/packages/docusaurus-mdx-loader
Sébastien Lorber d86aa0da5f
fix(mdx-loader): get correct error line numbers, handle front matter + contentTitle with remark (#9386)
2023-10-09 14:55:09 +02:00
..
src fix(mdx-loader): get correct error line numbers, handle front matter + contentTitle with remark (#9386) 2023-10-09 14:55:09 +02:00
.npmignore
README.md docs: document siteConfig.markdown + better mdx-loader retrocompat (#8419) 2022-12-07 17:59:51 +01:00
package.json fix(mdx-loader): get correct error line numbers, handle front matter + contentTitle with remark (#9386) 2023-10-09 14:55:09 +02:00
tsconfig.json

README.md

@docusaurus/mdx-loader

Docusaurus webpack loader for MDX.

Installation

yarn add @docusaurus/mdx-loader

Usage

// ...
module: {
  rules: [
    // ...
    {
      test: /\.mdx?$/,
      use: [
        'babel-loader',
        {
          loader: '@docusaurus/mdx-loader',
          options: {
            // .. See options
          },
        },
      ],
    },
  ];
}

Options

rehypePlugins

Array of rehype plugins to manipulate the MDXHAST

remarkPlugins

Array of remark plugins to manipulate the MDXAST

metadataPath

A function to provide the metadataPath depending on current loaded MDX path that will be exported as the MDX metadata.

markdownConfig

The global Docusaurus Markdown config (config.markdown), that plugin authors should forward:

const loader = {
  loader: require.resolve('@docusaurus/mdx-loader'),
  options: {
    markdownConfig: siteConfig.markdown,
  },
};