Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@politico/markdown-react-loader

Package Overview
Dependencies
Maintainers
12
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@politico/markdown-react-loader

Webpack loader, loads markdown files as React components

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
12
Weekly downloads
 
Created
Source

POLITICO

@politico/markdown-react-loader

Loads markdown files for use as React components.

Install

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

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 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 start

Development

Make it better, then:

$ npm publish --access public

FAQs

Package last updated on 05 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc