Render Markdown using React with React-Remarkable

Akash Gutha
InstructorAkash Gutha
Share this video with your friends

Social Share Links

Send Tweet
Published 7 years ago
Updated 5 years ago

We will use the React-Remarkable library to render markdown onto our React DOM. This library uses the Remarkable library to render markdown.

Installation Guide

npm install --save react-remarkable

Importing Guide

import Markdown from 'react-remarkable'

[00:01] I have a basic React project set up now. First, we'll go ahead and install the React-Remarkable library. The React-Remarkable library gives you a Markdown component that renders Markdown onto your HTML. Once you have it installed, we can go ahead and import it.

[00:23] We'll import Markdown from our React-Remarkable library. Once we have the Markdown imported, we can go ahead and clear the boilerplate code, and add our Markdown component. It takes in a parameter of source, which will be rendered onto our HTML.

[00:45] We just pass in the ID. We can call this, this is a heading. If you refresh the browser, you can see that the Markdown has been rendered as expected. Now, we'll add another Markdown component, and we'll pass in the Markdown this time as a child element.

[01:08] Let's write in text in bold. Let's go and refresh our browser. You can see there is an error. It says that adjacent JSX element must be wrapped in an enclosing tag. Let's go ahead, take our elements, and enclose it in a div tag. As you can see, the text is rendered in bold.

egghead
egghead
~ 7 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today