0.0.3 • Published 7 years ago
@politico/markdown-react-loader v0.0.3

@politico/markdown-react-loader
Loads markdown files for use as React components.
Install
$ yarn add -D @politico/markdown-react-loader react-markdownUse
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 pass any valid props that you would otherwise pass to react-markdown.
<Text linkTarget='_blank' />The loader also preprocesses the text of your markdown files through mustache.js, so you can also pass a context object to your component and add mustache's templating syntax to make your markdown even more powerful.
This is my **{{ mood }}** markdown file.<Text context={{ mood: 'AWESOME' }} />Test
$ yarn startDevelopment
Make it better, then:
$ npm publish --access public