question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What is the MDXProvider?

See original GitHub issue

The section in the README on the MDXProvider is very short and seems to assume a lot… I don’t know what this is, why it exists, what it’s for, etc. Could someone expand on it?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

14reactions
silvenoncommented, Jul 25, 2018

Does this clear things up?

import { MDXProvider } from '@mdx-js/tag'

import One from './one.mdx'
import Two from './two.mdx'
import Three from './three.mdx'

import { Title, Subtitle } from './body'

const components = {
  h1: Title,
  h2: Subtitle,
}

const AppWithoutProvider = () => (
  <div>
    <One components={components} />
    <Two components={components} />
    <Three components={components} />
  </div>
)

const AppWithProvider = () => (
  <MDXProvider components={components}>
    <One />
    <Two />
    <Three />
  </MDXProvider>
)
1reaction
silvenoncommented, Sep 18, 2018

I’m closing this as a stale issue. This is the current documentation for MDXProvider: https://mdxjs.com/getting-started/#mdxprovider, and we’re open to improvements.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using MDX
Import MDXProvider from that package. Use it to wrap your top-most MDX content component and pass it your components instead: Diff. import ...
Read more >
Customizing Markdown Components - Gatsby
Components passed to the MDXProvider are used to render the HTML elements that Markdown creates. It uses React's Context API. Related. MDX components...
Read more >
Use MDXProvider to Control the Rendering of Markdown ...
MDX allows you to control the rendering of any element from your markdown document, such as the heading, paragraphs, or code blocks.
Read more >
Advanced Features: Using MDX - Next.js
To do this you use the MDXProvider and pass a components object as a prop. Each object key in the components object maps...
Read more >
MDX, not your parents' markdown - blog
The MDXProvider has a property called 'components' and this how you provide the components to the MDX renderer.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found