将 Markdown 转换为实时 React 演示
No longer maintained see https://mdxjs.com for a better alternative
Convert markdown to live React demos
Built with: react-markdown, React Live, Rebass, and styled-components
npm i -g live-docConvert a markdown file to a React app and save as index.html:
doc README.mdBy using the .jsx language attribute at the beginning of a code block,
live-doc will convert the example into a live-editable example using React Live.
In this example, the Rebass Heading component has been added to the scope in the docs/config.js file,
making it available to the React Live preview.
To enable the noInline mode
in React Live, use the ..jsx language attribute at the beginning of a code block.
const Hello = () =>
Hello
const App = () => (
)
render()-d --out-dir Output directory
-c --config Path to config fileTo customize the output React app, create a config file that exports an object.
// config.js
module.exports = {
// Scope for react-live previews
scope: {
foo: 'Hello'
},
title: 'Page Title',
css: 'body { color: tomato }',
script: 'console.log("Hello");',
// Meta tags
meta: [
{
name: 'og:image',
content: 'kitten.jpg'
}
]
}Then pass the file with the --config flag to the CLI.
doc README.md --config config.jsMIT License
暂无开放 Issues,或尚未同步最近议题。