react-markdown-reader
v1.2.0
Published
markdown reader
Downloads
40
Readme
react-markdown-reader
Install
npm install html-loader --save-dev
npm install markdown-loader --save-dev
npm install react-markdown-reader --save-dev
Usage
webpack.config.js
webpack >= 2
const markdownRenderer = require('react-markdown-reader').renderer;
{
test: /\.md$/,
use: [{
loader: 'html-loader'
}, {
loader: 'markdown-loader',
options: {
renderer: markdownRenderer(/**languages[string]**/)
}
}]
}
注意: markdownRenderer 参数 languages,是为了按需加载,解决加载所有的语言包文件过大的问题。默认值:
['javascript', 'bash', 'xml', 'css', 'markdown', 'less'];
Exmaple
import { Markdown } from 'react-markdown-reader';
import 'react-markdown-reader/less/highlight.less';
<Markdown>{require('./README.md')}</Markdown>;