Blazing Fast @m2d/react-markdown

Blazing Fast @m2d/react-markdown

posted Originally published at dev.to 2 min read

We just benchmarked @m2d/react-markdown against the popular react-markdown — and the results are in:

Competitive speed,
Cleaner architecture,
Purpose-built for MDAST-first workflows like mdast2docx


Why Another Markdown Renderer?

Most renderers are great at one thing: rendering. But if you’re working on docx/pdf export, hybrid output (MDX/HTML/JSX), or unified pipelines, you need something:

  • Fast
  • Extensible
  • MDAST-respecting
  • SSR/Streaming/Edge-ready

That's exactly what @m2d/react-markdown is for.


Real Benchmarks — No Hype

We ran thorough benchmarks with various markdown types: simple notes, complex nested GFM, large tutorials, and even full-site markdown dumps.

Key Takeaways:

  • @m2d/react-markdown outperformed or matched react-markdown in several medium/complex files
  • Bulk rendering (all files in one go) saw better JSX tree handling
  • Slightly slower in very short/simple cases (which don't matter much in real apps)

Check out the full results here:
benchmark.md

Includes tables, deltas, and even visual charts!


Perfect Companion for mdast2docx & Export Tooling

If you're building tools like:

  • mdast2docx (Markdown → Word)
  • Hybrid export systems (PDF/HTML from a single source)
  • Local-first writing tools with output control

Then @m2d/react-markdown is your new best friend.
It retains the full MDAST, supports plugin injection, and gives you full control over rendering + export paths.


Join the Discussion – Shape the Future

We’re actively planning support for:

  • Inline JSX support in markdown
  • Better handling of reusable ASTs
  • Declarative hydration markers for SSR/Edge use

Engage, vote, or suggest improvements here:
https://github.com/md2docx/react-markdown/discussions/3


Build Your Own Library Like This

This library was scaffolded using react18-tools/turborepo-template — a production-grade template for building and publishing modern React libraries.

If you want to:

  • Build & test across Next.js/Vite
  • Auto-generate docs & examples
  • Publish fast and right

Use this template to create your own library in minutes.


Call for Contributors

If you:

  • Love performance and clean architecture
  • Use React with Markdown in any serious way
  • Care about maintainable DX and OSS karma

…then jump in!

Star, fork, or file issues here → https://github.com/md2docx/react-markdown

Or explore mdast2docx to see how this library integrates into real export workflows.


♂️ Built with Care

This isn’t just a library — it’s a piece in a larger mission to simplify dev workflows and bridge content with output in meaningful ways.

If you read this far, tweet to the author to show them you care. Tweet a Thanks

@m2d/react-markdown is impressive—fast, SSR-ready, and great for complex markdown and exports. Love the MDAST focus and plugin support. Inline JSX support coming soon? Cool! How does it beat existing renderers?

Existing renderers are great. I am just removing unnecessary bloat that they need for backward compatibility, etc. And adding new features.

Also, for benchmarking, I have disabled the logs. React-markdown actually throws some logs around the empty string passed to src, and that further degrades the benchmark for react-markdown. So, all these are well handled.

And focus is on reusing the mdast tree and extending the functionality

More Posts

Client side pagination is not good in some cases

Ozkan Pakdil - Aug 8

Beginner’s Guide to GitHub-Flavoured Markdown

Methodox - Jun 2

Learn Markdown from best and free resources

atulcodex - Apr 16, 2024

Bad Prompts Are the Fast Food of AI (Quick, Cheap… and Regrettable)

Yash - Sep 30

Frontend 2025: Make It Fast, Keep It Simple

Vishwajeet Kondi - Sep 2
chevron_left