A React SPA for rendering Markdown with inline Mermaid diagram support. Features a split-pane editor with live preview and PDF export capability.
- GitHub Flavored Markdown (GFM) support
- Inline Mermaid diagram rendering
- Multiple rendering options via beautiful-mermaid:
- Default (mermaid.js) - standard SVG rendering
- Beautiful Mermaid SVG - styled SVG output
- Beautiful Mermaid ASCII - terminal-friendly text output
- Beautiful Mermaid theme controls:
- Built-in light and dark presets
- Custom colors and font family
- Diagram padding, node gap, layer gap, and component gap
- Transparent SVG background
- Interactive XY chart tooltips
- Live preview with split-pane editor
- Open preview in separate tab for PDF export
- Copy preview to clipboard for pasting into Outlook, Word, and Confluence (SVG diagrams are converted to PNG images for compatibility)
- Render mode and theme settings persisted to localStorage
- Print-friendly styling
# Install dependencies
pnpm install
# Start development server
pnpm dev
# Build for production
pnpm build- Write Markdown in the left editor pane
- See live preview in the right pane
- Use fenced code blocks with
mermaidlanguage for diagrams:
```mermaid
flowchart TD
A[Start] --> B{Decision}
B -->|Yes| C[Result]
B -->|No| D[Other]
```- Select a rendering mode from the "Renderer" dropdown in the header
- When using a Beautiful Mermaid mode, click "Theme" to customize diagram colors, typography, layout spacing, and XY chart tooltip behavior
- Click "Copy" in the preview pane header to copy the rendered content (including diagrams as images) to your clipboard, then paste into Outlook, Word, or Confluence
- Click the
▾toggle next to Copy to choose a diagram conversion strategy (Auto, SVG, or DOM) - Click "New Tab" to open a standalone preview for PDF export via browser print
Outlook, Word, and Confluence don't render inline SVGs from clipboard HTML, so the copy feature converts Mermaid diagrams to PNG images before writing to the clipboard. Three conversion strategies are available:
- Auto (default) — tries SVG pipeline first, falls back to DOM capture on failure
- SVG (fast) — serializes SVG to XML, strips
<foreignObject>elements (replacing with<text>), draws onto a<canvas>, and exports as PNG. Fast but approximate for flowcharts that use foreignObject for text labels. - DOM (pixel-perfect) — uses
html2canvasto render the diagram container directly from the DOM. Slower but captures exactly what you see on screen, including custom themes.
In all strategies:
- The preview DOM is cloned so the page is never modified
- Diagrams are converted to PNG at 2x resolution (retina clarity), capped at 600px wide
- Critical CSS (fonts, colors, borders, table styling) is inlined since clipboard HTML has no stylesheet
- The result is written to the clipboard as both
text/html(for rich paste) andtext/plain(for plain text editors) usingnavigator.clipboard.write()
| Package | Purpose |
|---|---|
| react | UI framework for building the component-based interface |
| react-dom | React renderer for web browsers |
| react-markdown | Converts Markdown strings into React components |
| remark-gfm | Plugin for react-markdown that adds GitHub Flavored Markdown support (tables, strikethrough, task lists, etc.) |
| rehype-raw | Plugin that allows raw HTML embedded in Markdown to pass through |
| mermaid | Renders diagram definitions (flowcharts, sequence diagrams, etc.) into SVG |
| beautiful-mermaid | Alternative mermaid renderer with styled SVG, ASCII output, XY charts, presets, and layout options |
| html2canvas | Renders DOM elements to canvas for pixel-perfect diagram-to-PNG conversion |
| Package | Purpose |
|---|---|
| vite | Fast build tool and dev server with HMR |
| typescript | Type checking for JavaScript |
| @vitejs/plugin-react | Vite plugin for React Fast Refresh |
| eslint | Code linting |