hashicorp / next-mdx-remote

Load MDX content from anywhere
Mozilla Public License 2.0
2.68k stars 140 forks source link

Add custom component on `compileMDX` #379

Closed AugustinMauroy closed 1 year ago

AugustinMauroy commented 1 year ago

My question/feature proposal is it possible to have custom components by compiling the mdx with the compileMDX function?

BRKalow commented 1 year ago

Yep, this is possible:

import { compileMDX } from 'next-mdx-remote/rsc'

...

async function Page() {
    const { content } = await compileMDX({
        source: '<Test />',
        components: { Test: () => <>Hello world</> }
    })

    return content
}
AugustinMauroy commented 1 year ago

Thanks a lot for everything !