0.2.0 • Published 3 years ago

esbuild-mdx v0.2.0

Weekly downloads
9
License
MIT
Repository
github
Last release
3 years ago

esbuild-mdx

esbuild-mdx resolves .md and .mdx-delimited files as markdown components you can render in your React components.

  • Add dependencies:

    yarn add react react-dom
    yarn add --dev @mdx-js/react esbuild-mdx
  • Create esbuild.js:

    require("esbuild").build({
    	// ...
    	plugins: [require("esbuild-mdx")()],
    	// ...
    })
  • Create a .md or .mdx-delimited file:

    # Hello, world rendered by `esbuild-mdx`!
  • Import your .md or .mdx file and render as a React component:

    import React from "react"
    import ReactDOM from "react-dom"
    
    import MarkdownComponent from "./example.md"
    
    function App() {
    	return (
    		<div>
    			<h1>
    				Hello, world rendered by <code>React</code>!
    			</h1>
    			<MarkdownComponent />
    		</div>
    	)
    }
    
    ReactDOM.render(<App />, document.getElementById("root"))

See esbuild-mdx-example for a reference implementation.

Note: react, react-dom, and @mdx-js/react are peer dependencies.

License

Licensed as MIT open source.

0.2.0

3 years ago

0.2.0-rc.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago