Markdown Libraries
Choose the right library for your Markdown needs.
marked
Fast and lightweight. Good for basic needs.
import { marked } from 'marked';
const html = marked.parse('# Hello World');
marked.setOptions({
gfm: true,
breaks: true,
});
markdown-it
Extensible and CommonMark compliant.
import MarkdownIt from 'markdown-it';
const md = new MarkdownIt({
html: true,
linkify: true,
});
const html = md.render('# Hello World');
// Add plugins
import emoji from 'markdown-it-emoji';
md.use(emoji);
react-markdown
Render Markdown as React components.
import ReactMarkdown from 'react-markdown';
function Article({ content }) {
return <ReactMarkdown>{content}</ReactMarkdown>;
}
Comparison
| Library | Size | Speed | Extensibility |
|---|
| marked | Small | Fast | Moderate |
|---|
| markdown-it | Medium | Fast | High |
|---|
| react-markdown | Medium | Moderate | High |
|---|