docusaurus/packages/docusaurus-mdx-loader
Alexey Ivanov daba917e7c
feat(core): add new site config option `siteConfig.markdown.anchors.maintainCase` (#10064)
Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
Co-authored-by: sebastien <lorber.sebastien@gmail.com>
2024-04-25 16:35:38 +02:00
..
src feat(core): add new site config option `siteConfig.markdown.anchors.maintainCase` (#10064) 2024-04-25 16:35:38 +02:00
.npmignore misc: make copyUntypedFiles work for watch mode (#7445) 2022-05-18 19:18:32 +08:00
README.md docs: document siteConfig.markdown + better mdx-loader retrocompat (#8419) 2022-12-07 17:59:51 +01:00
package.json chore: release Docusaurus 3.2.1 (#10016) 2024-04-04 20:17:34 +02:00
tsconfig.json refactor: extract base TS client config + upgrade TS + refactor TS setup (#10065) 2024-04-19 21:03:32 +02:00

@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,
  },
};