Skip to content

Hooking onto Docusaurus' MDX Loader #10829

Answered by slorber
AndrewSepic asked this question in General
Discussion options

You must be logged in to vote

So your remark plugin essentially transforms:

:::step
Other content & children go here
:::

into

<StepComponent>
  Other content & children go here
</StepComponent>

Note that it's possible for your remark plugin to automatically add the import to the MDX file. But your solution using our MDXComponents mapping should work, which under the hood is just using a regular MDXProvider:

import React, {type ReactNode} from 'react';
import {MDXProvider} from '@mdx-js/react';
import MDXComponents from '@theme/MDXComponents';
import type {Props} from '@theme/MDXContent';

export default function MDXContent({children}: Props): ReactNode {
  return <MDXProvider components={MDXComponents}>{children}</MDX…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@AndrewSepic
Comment options

@slorber
Comment options

slorber Jan 17, 2025
Collaborator

Answer selected by AndrewSepic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants