MDX Book is a docz inspired documentation generator with a playground and without gatsby and ssr.
npm install --save-dev @coralproject/mdx-book
This is an example entry file that your webpack configuration should include:
// main.jsimport MDXBook from "@coralproject/mdx-book";import theme from "prism-react-renderer/themes/nightOwl";ReactDOM.render(<MDXBookdocuments={require.context(__dirname, true, /^.*\.mdx$/)}playgroundTheme={theme}/>,container);
Just add this rule in your webpack configuration:
// webppack.config.jsmodule.exports = {...module: {rules: [{test: /\.mdx?$/,use: ["babel-loader", "@coralproject/mdx-book/loader"]}]}};
This is the minimum required babel configuration:
// babel.config.jsmodule.exports = {plugins: ["transform-class-properties"],presets: ["@babel/react",["@babel/env", { modules: false }]]};
import { Playground } from "@coralproject/mdx-book";### Playground<Playground><div>Hello</div></Playground>