Releases: mdx-js/mdx
Improve import/export parsing
- String interpolation and other syntax is now correctly handled with imports and exports
- Props passed in are now also exposed to JSX block
skipExport
option- Examples improvements
- Parcel plugin now handles
.md
files npm init mdx
Hoist statics
MDXTag now hoists non-React statics of Layout components. This is useful for usage with getInitialProps
.
Parcel plugin, runtime package and improved React context support
Improve React 16 support
Uses create-react-context
to ponyfill React's context API to ensure support for all React 16 versions.
Add support for components as properties
Components like Foo.Bar
weren't parsed as JSX if they started the JSX block. They are now properly parsed.
Implement runtime using buble
npm install --save @mdx-js/runtime
Parses and renders MDX in a runtime environment
⚠️ Warning
This is not the preferred way to use MDX since it introduces a substantial amount of overhead and dramatically increases bundle sizes. It should only be used with sandboxed user input.
Add footnote support
v0.12.0 v0.12.0
MDX Provider
If you're using an app layout that wraps your JSX, you can use the MDXProvider
to only pass your components in one place:
import React from 'react'
import { MDXProvider } from '@mdx-js/tag'
import * as components from './markdown-components'
export default props =>
<MDXProvider components={components}>
<main {...props} />
</MDXProvider>
Layout support via export default
You can now export a component as the default
and it will wrap the output JSX. This is great when your MDX file is the entrypoint like a standalone page.
import MyLayout from '../somewhere'
# hello world
some text
export default (props) => <MyLayout {...props} title="test" />