A React and TypeScript component for editing Markdown with an inline preview and code highlighting. It wraps a textarea instead of binding to Monaco or CodeMirror.
Overview
React Md Editor is a UI component for apps that need users to write or edit Markdown in the browser. It shows the source in an editable area alongside preview rendering, with syntax highlighting for fenced code blocks.
The implementation uses textarea encapsulation, so it does not depend on large in-browser code editors. It supports GitHub-flavored Markdown, tab indentation, automatic lists on new lines, line duplication and movement shortcuts, and optional dark mode. You can run it in full editor mode or use exposed utilities for a headless setup with your own chrome.
Toolbar and preview behavior are configurable through commands, extra commands, and custom components. Optional builds reduce bundle size by dropping or narrowing syntax-highlight language packs. Preview can be extended for KaTeX math and Mermaid diagrams. Documentation covers Next.js App Router usage, placeholder and max length, height resize, and sanitization guidance when authors are not fully trusted.
Compared with editors built on Ace, CodeMirror, or Monaco, this package stays lighter by staying on a textarea core while still offering a full preview pipeline.
Key features
- Textarea-based editor without Monaco or CodeMirror
- Live Markdown preview with syntax highlighting
- GitHub-flavored Markdown support
- Customizable toolbar commands
- Headless mode utilities
- Dark mode support
- Optional KaTeX and Mermaid preview
- Next.js integration examples
Use cases
- In-app Markdown authoring in React apps
- CMS or admin panels with rich text in Markdown
- Documentation or note editors in the browser
- Comment or readme editors with preview