ehome-react-markdown-doc-loader
React backend for markdown-doc-loader
Last updated 2 years ago by ehome .
MIT · Original npm · Tarball · package.json
$ cnpm install ehome-react-markdown-doc-loader 
SYNC missed versions from official npm registry.

ehome-react-markdown-doc-loader

A webpack loader to convert markdown-doc-loader's output to React component.

markdown-doc-loader converts a markdown file to a list of sections. There're three types of section: markdown, style and demo.

Usage

Use as a webpack loader

{
	module: {
		rules: [
			{
			test: /\.md$/,
			use: [
				'babel-loader',
				{
					loader: require.resolve('react-markdown-doc-loader'),
					options: {
						jsTemplate: path.join(__dirname, './react-template.js'),
						renderers: {
							markdown: 'Markdown',
							style: 'Style',
							demo: 'Demo'
						}
					}
				}
				'markdown-doc-loader'
			]
			}
		]
	}
}

Options

  • jsTemplate: path to js template file, uses babel-template.
  • renderers: a map of component names to different types of sections

Available properties in the template:

  • SECTIONS: All sections in the file, style, demo and markdown. Styles are compiled to css with precss demos are code fragments that return a React node markdowns are compiled to html

  • IMPORTS: All imports from demos

  • DEMO_DECLARATIONS: Declarations for demos

Take a look at sample/template.js.

Current Tags

  • 1.0.0                                ...           latest (2 years ago)

1 Versions

  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 6
Dependencies (22)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |