Webpack loader, loads markdown files as React components

Usage no npm install needed!

<script type="module">
  import politicoMarkdownReactLoader from 'https://cdn.skypack.dev/@politico/markdown-react-loader';




Loads markdown files for use as React components.


$ yarn add -D @politico/markdown-react-loader react-markdown


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 = () => (
    <Text />

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' }} />


$ yarn start


Make it better, then:

$ npm publish --access public