Render Mermaid flowcharts or sequence diagrams to SVG inside a Node.js server or CLI tool without needing a browser.
Display diagrams as ASCII art in a terminal application using Unicode box-drawing characters.
Add diagram rendering to a React component that re-renders without flicker, using the synchronous output with memoization.
Apply a color theme like Dracula, Nord, or Catppuccin to diagrams in a documentation tool by providing a background and foreground color.
Install via npm, works in any JavaScript environment with no browser or DOM required.
beautiful-mermaid is a TypeScript library for rendering Mermaid diagrams as clean SVG images or as ASCII art for terminals. Mermaid is a popular text-based format for writing diagrams in plain text, and this library provides an alternative renderer focused on visual quality and flexibility compared to the official Mermaid renderer. The library was built by the team behind Craft, a note-taking and document tool, to power diagrams inside their AI agent product. The README describes motivations as: the default Mermaid renderer requires a browser DOM and can be slow, its theming involves CSS complexity, and it cannot render to text for command-line tools. This library addresses all three by running in pure TypeScript with no browser dependencies, supporting ASCII output alongside SVG, and using a simple two-color theming system. The theming approach is one of the library's main features. You provide a background color and a foreground color, and the library derives all other diagram element colors automatically. For more control, you can supply additional optional colors for specific elements. Fifteen built-in themes are included, covering common editor and IDE color schemes like Tokyo Night, Catppuccin, Nord, Dracula, GitHub, Solarized, and One Dark. Themes can also be switched live using CSS custom properties without re-rendering. Rendering is synchronous rather than asynchronous, which makes it straightforward to use inside React components with memoization, avoiding the flickering that can occur when diagram rendering happens in side effects. The library supports flowcharts, state diagrams, sequence diagrams, class diagrams, entity-relationship diagrams, and XY charts including bar and line charts. The ASCII output uses Unicode box-drawing characters to produce terminal-friendly diagrams, adapted from an earlier Go project. The package is available on npm and works in any JavaScript environment.
← lukilabs on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.