Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 4 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

react-markdown

React component for rendering markdown with customizable component handling.

Markdown, editors and contentNPM

GitHubWebsite

1. License

License from npm.

github.com/remarkjs/react-markdown

From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error

What react-markdown does

react-markdown turns a markdown string into real React elements through a syntax tree, so it never needs <code>dangerouslySetInnerHTML</code>, and you can swap any HTML element for your own component.

react-markdown popularity

83 / 100
Gid Score, #52 overall
61.6M
downloads a week, npm
15.9K
GitHub stars
248
agent projects use it
react-markdown: downloads per weeknpm, react-markdown 61,554,226
react-markdown: GitHub starsremarkjs/react-markdown 15,944

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How react-markdown is used

  • react-markdown is a dependency in 248 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (5.1% of the 4,867 JavaScript/TypeScript ones), #1 of 149 in markdown, editors and content.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 1,460; those are left out of every share on this page.
  • The most used alternative in our scan is Marked (163 projects).
  • Projects that use it most often also use React (99.2%), Lucide React (77.0%), remark-gfm (66.5%).
  • It is more common in projects set up for Gemini CLI (7.0%) than for OpenCode (3.5%).

By coding agent

150 projects, 4.6%
115 projects, 3.8%
106 projects, 4.3%
33 projects, 7.0%
18 projects, 5.4%
18 projects, 3.8%
14 projects, 5.0%
12 projects, 3.5%

Often used with

In 99.2% of its projects
In 77.0% of its projects
In 66.5% of its projects
In 67.3% of its projects
In 87.9% of its projects
In 66.9% of its projects
In 58.5% of its projects
In 61.3% of its projects

react-markdown in practice

Strengths

No innerHTML, by design

The README gives three reasons to pick this over other markdown-in-React options. Others often rely on <code>dangerouslySetInnerHTML</code>, have markdown bugs, or don't let you swap elements for components. react-markdown is built to avoid all three.

Your components instead of raw tags

A <code>components</code> prop maps tag names to your own React components. The README uses this to send code blocks to <code>react-syntax-highlighter</code>. Each component also receives the original hast <code>node</code>.

Links are filtered the way GitHub does it

URLs go through <code>defaultUrlTransform</code> unless you pass your own <code>urlTransform</code>. The default keeps a short list of protocols and relative URLs.

The whole remark and rehype plugin pool

Plugins go in <code>remarkPlugins</code> (markdown stage) or <code>rehypePlugins</code> (HTML stage). The README's math example pairs <code>remark-math</code> with <code>rehype-katex</code>.

Watch out for

ESM only, Node 16+

There is no CommonJS build. The current line, <code>react-markdown@10</code>, targets Node.js 16. The README also says it works in modern browsers but not IE 11.

Async plugins need a different component

The default <code>Markdown</code> export is synchronous. With async plugins, use <code>MarkdownAsync</code> on the server or <code>MarkdownHooks</code> on the client.

MarkdownHooks renders nothing at first

<code>MarkdownHooks</code> relies on <code>useEffect</code> and <code>useState</code>, so output appears only after processing on the client. A <code>fallback</code> prop sets what shows in the meantime.

Render GFM (tables, tasklists, bare URLs) with remark-gfm

import React from 'react'
import {createRoot} from 'react-dom/client'
import Markdown from 'react-markdown'
import remarkGfm from 'remark-gfm'

const markdown = `Just a link: www.nasa.gov.`

createRoot(document.body).render(
  <Markdown remarkPlugins={[remarkGfm]}>{markdown}</Markdown>
)

More about react-markdown

Funding
  • GitHub Sponsors: https://github.com/unifiedjs
  • Open Collective: https://opencollective.com/unified
  • thanks.dev: https://thanks.dev/u/gh/remarkjs
  • 25 GitHub sponsors

See all

Head to head
Packages around it
  • lucide-react: Icon components
  • tailwind-merge: Tailwind class merging
  • remark-gfm: GFM plugin: tables, tasklists
  • class-variance-authority: Component style variants
  • tailwindcss: Utility-first CSS
  • clsx: className builder
More in Markdown, editors and content

Alternatives

react-markdown This page

MITGid 8361.6M/wk

Marked

Fast, efficient markdown parser for converting markdown to HTML.

MITGid 84138M/wk

MDX

Write JSX directly in Markdown for rich, interactive content and documentation.

MITGid 7333.8M/wk

Compare react-markdown with another tool

Get started

Install it.

npm install react-markdown

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## react-markdown
- Import the default export (`import Markdown from 'react-markdown'`). The package is ESM only and needs Node.js 16+.
- Pass the markdown string as `children`. Never render markdown with `dangerouslySetInnerHTML`.
- For tables, strikethrough, tasklists or bare URLs, add `remark-gfm` to `remarkPlugins`. To pass plugin options, use `[[plugin, options]]`.
- Customize output through the `components` map (for example `code`, `a`, `h2`). Don't post-process the HTML.
- With async plugins, use `MarkdownAsync` on the server or `MarkdownHooks` on the client. Give `MarkdownHooks` a `fallback`.
- Use either `allowedElements` or `disallowedElements`, never both. Keep the default `urlTransform` unless you need different URL rules.
- When using `rehype-katex`, import `katex/dist/katex.min.css` yourself.