Navigate:
All Reposreact-markdown
~$REACTM0.1%

react-markdown: Markdown component for React

Render markdown as React components via unified.

LIVE RANKINGS • 06:51 AM • STEADY
OVERALL
#195
4
FRONTEND
#21
3
30 DAY RANKING TREND
ovr#195
·Front#21
STARS
15.4K
FORKS
922
DOWNLOADS
7.8M
7D STARS
+8
7D FORKS
0
See Repo:
Share:

Learn more about react-markdown

react-markdown is a React library that converts markdown text into React virtual DOM elements. It builds on the unified, remark, and rehype toolchain to parse markdown into an abstract syntax tree, transform it through plugins, and render it as React components. The library supports CommonMark compliance and GitHub Flavored Markdown through optional plugins, and allows developers to replace standard HTML elements with custom React components. It avoids dangerouslySetInnerHTML by constructing a virtual DOM directly from the syntax tree, enabling React's standard reconciliation and update mechanisms.


1

Virtual DOM Rendering

Constructs React elements directly from the markdown AST instead of using dangerouslySetInnerHTML. Enables React's standard reconciliation, diffing, and update mechanisms for safer, more performant rendering.

2

Component Substitution System

Replace any generated HTML element with custom React components through a simple mapping. Enables syntax highlighting, design system integration, and custom behaviors without wrapper divs or DOM manipulation.

3

Unified Plugin Ecosystem

Built on the unified.js ecosystem, enabling transformation pipelines with remark and rehype plugins. Add syntax highlighting, math rendering, or custom transformations by composing existing plugins or writing custom processors.


import ReactMarkdown from 'react-markdown';

const markdown = '# Hello World\n\nThis is **bold** text.';

export default function App() {
  return <ReactMarkdown>{markdown}</ReactMarkdown>;
}


v10.1.0

Adds fallback prop to MarkdownHooks and fixes a race condition in the same component.

  • Use the new `fallback` prop on `MarkdownHooks` to handle loading or error states during async rendering.
  • Update code relying on `MarkdownHooks` timing; the race condition fix may change render behavior in edge cases.
v10.0.1

Patch release fixing TypeScript compilation performance when using custom component props.

  • Upgrade if you experience slow TypeScript builds with react-markdown's component overrides.
  • No breaking changes or migration steps required for this performance fix.
v10.0.0

Breaking: removes the `className` prop entirely; components must use alternative styling approaches.

  • Remove any `className` prop usage from react-markdown components before upgrading.
  • Consult the changelog for recommended alternatives to apply CSS classes or inline styles.


[ EXPLORE MORE ]

Related Repositories

Discover similar tools and frameworks used by developers