
@politico/markdown-react-loader
Loads markdown files for use as React components.
Install
$ yarn add -D react-markdown @politico/markdown-react-loader
Use
Add to your Webpack config.
module.exports = {
module: {
loaders: [
{
test: /\.md$/,
loader: '@politico/markdown-react-loader'
}
]
}
}
Import and use markdown files.
import Text from 'text.md';
const MyComponent = () => (
<div>
<Text />
</div>
);
You can also pass any valid props that you would otherwise pass to react-markdown.
<Text linkTarget='_blank' />
Test
$ yarn start
Development
Make it better, then:
$ npm publish --access public