Some React Components to use Markdown easily

Usage no npm install needed!

<script type="module">
  import reactMarkedMarkdown from '';


Travis branch npm version npm

React Marked Markdown

A react components package that helps you use Markdown easily.

Writing in Markdown is an amazing experience. Setting up all components and parser is kind of a pain.

Basic Usage

  • Install with npm install --save react-marked-markdown
  • Import component(s) you want
import {  MarkdownPreview  } from 'react-marked-markdown';


Basic Markdown view

Display Markdown is really easy with MarkdownPreview component.

Here is a simple example :

import React from 'react';

import { MarkdownPreview } from 'react-marked-markdown';

const Post = ({ post }) => (
    <h1>{ post.title }</h1>
    <MarkdownPreview value={ post.content }/>

export default Post;


Behind the scenes, react-marked-markdown uses marked as Markdown parser. So all marked options are available here.

Here is an example with default options :

  value="# Hey !"
    gfm: true,
    tables: true,
    breaks: false,
    pedantic: false,
    sanitize: true,
    smartLists: true,
    smartypants: false
   }} />

A list of options can be found here.

Syntax highlighting

react-marked-markdown supports syntax highlighting with highlight.js

CSS Classes

All react-marked-markdown components are unstyled, meaning that you can style them as you want like every others React elements.

<MarkdownPreview className="ui post content" value="#Hey !" />


LiveMarkdownTextarea allows you to write Markdown in a textarea and see a preview of what you are writing.

  placeholder="Enter your comment here."
  inputClassName="field column"
  previewClassName="column comment-preview"

Create your own Markdown Editor

You can even create your own Markdown Editor with MarkdownPreview and MarkdownInput components.

As an example here is the code of LiveMarkdownTextarea component. Note that there is also a clear() method that we can call from parent component to clear the editor.

class LiveMarkdownTextarea extends React.Component {
  constructor(props) {
    this.state = {
      value: props.defaultValue ? props.defaultValue : '',
  handleTextChange(e) {
    this.setState({ value: });
    if (this.props.onTextChange) {
  clear() {
    this.setState({ value: '' });
  render() {
    const {
    } = this.props;
    const { value } = this.state;
    return (
      <section className={ className }>
          placeholder={ placeholder }
          onChange={ this.handleTextChange.bind(this) }
          value={ value }
          className={ inputClassName }

          value={ value }
          className={ previewClassName }