markdown reader for react
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
less
src
.babelrc
.editorconfig
.gitignore
.npmignore
LICENSE
README.md
package.json

README.md

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: {
      pedantic: true,
      renderer: markdownRenderer(/**languages[string]**/)
    }
  }]
}

注意: markdownRenderer 参数 languages,是为了按需加载,解决加载所有的语言包文件过大的问题。默认值:

["javascript", "bash", "xml", "css", "markdown", "less"];

Exmaple

import { Markdown } from 'react-markdown-reader';
import 'markdownloader/less/highlight.less'


<Markdown>
    {require('./README.md')}
</Markdown>