kentcdodds / mdx-bundler

🦤 Give me MDX/TSX strings and I'll give you back a component you can render. Supports imports!
MIT License
1.78k stars 75 forks source link

Share custom components in nested MDX files #227

Closed ProchaLu closed 7 months ago

ProchaLu commented 8 months ago

Closes #195

What:

This pull request adds a Readme guide to make sure custom components are accessible in nested MDX files.

Why:

With the current behaviour, passing custom components to nested MDX files is leading to unexpected rendering issues. This solution and Readme guide allows to share custom components across the MDX structure.

How:

Checklist:

ProchaLu commented 7 months ago

Hi @kentcdodds, can you check out the PR when you have a moment. Your feedback would be great and maybe the PR will be merged. Thanks!

karlhorky commented 7 months ago

This is not a very common usecase though

@kentcdodds Just ran across this - do you think it's not common? My gut feel says that it would be the most common use case.

Currently when you have the following simple setup, it breaks:

1.mdx

import Partial from './2.mdx'

<Partial />

2.mdx

# Partial content

Some content that is shared across multiple pages

<SomeComponentFromProvider /> {/* 💥 */}
kentcdodds commented 7 months ago

🤷‍♂️ I'd still like the docs for this moved down.

ProchaLu commented 7 months ago

@kentcdodds , thanks for the review! I changed the position and moved it before the "Known Issues" section

github-actions[bot] commented 3 months ago

:tada: This PR is included in version 10.0.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket: