babel-plugin-markdown-react

1.0.15 • Public • Published

babel-plugin-markdown-react

This plugin will use remarkable to pre-process all markdown within a Markdown component. Then we parse that HTML with babel into an AST and just replace the Markdown children node with the parsed AST.

Example

npm install babel babel-core babel-plugin-markdown-react --save

Follow the guidelines here https://babeljs.io/docs/advanced/plugins/ to work the plugin into your asset pipeline.

import React from "react";
import Markdown from "babel-plugin-markdown-react/markdown";


export default class RenderMarkdown extends React.Component {

    render() {
        return (
            <Markdown>
                ## Something

                ## Something else as important

                ```
                var a = 1;
                var b = 2;
                var c = a + b;

                console.log(c) //3 => Math
                ```
            </Markdown>
        )
    }
}

Package Sidebar

Install

npm i babel-plugin-markdown-react

Weekly Downloads

1

Version

1.0.15

License

MIT

Last publish

Collaborators

  • browniefed