Render Markdown As React Components – marked-react

Render Markdown as React components using marked.

How to use it:

1. Install & import.

# NPM
$ npm i marked-react

import ReactDOM from ‘react-dom’;

2. Basic usage.

const rootEl = document.getElementById('root');
ReactDOM.render(<Markdown># Hello world!</Markdown>, rootEl);

3. Available props.

const defaults = {
  // Add br tag on single line breaks.
  breaks: false,
  // Use approved Github Flavoured Markdown
  gfm: true,
  // A prefix url for any relative link.
  baseURL: null,
  // Open links in a new browser tab
  openLinksInNewTab: true,
  // A string to prefix the className in a <code> block. Useful for syntax highlighting.
  langPrefix: 'language-',
  // Renderer
  renderer: null,
};

Preview:

Render Markdown As React Components - marked-react

Download Details:

Author: sibiraj-s

Live Demo: View The Demo

Download Link: Download The Source Code

Official Website: https://github.com/sibiraj-s/marked-react

License: MIT

You Might Be Interested In:

Add Comment