Package Exports
- react-markdown-doc-loader
- react-markdown-doc-loader/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-markdown-doc-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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, usesbabel-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
andmarkdown
. Styles are compiled to css withprecss
demos are code fragments that return a React node markdowns are compiled to htmlIMPORTS
: All imports from demosDEMO_DECLARATIONS
: Declarations for demos
Take a look at sample/template.js
.