npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mermaid2term

v0.1.0

Published

Render Mermaid diagrams as ASCII/Unicode art in the terminal

Readme

mermaid2term

Render Mermaid diagrams as ASCII/Unicode art in the terminal.

┌───────┐
│       │
│ Start │
│       │
└───────┘
    │
    │
    │
┌───▼────┐
│        │
│ Process│
│        │
└────────┘
    │
    │ Yes
    ├────────────┐No
    │            │
┌───▼───┐   ┌────▼───┐
│       │   │        │
│  Done │   │  Skip  │
│       │   │        │
└───────┘   └────────┘

Installation

npm install -g mermaid2term

Or use directly with npx:

npx mermaid2term diagram.mmd

Usage

CLI

# From a file
mermaid2term diagram.mmd

# From stdin
echo 'graph LR; A-->B; B-->C' | mermaid2term

# With options
mermaid2term --charset ascii diagram.mmd

Options

| Option | Description | Default | |--------|-------------|---------| | -c, --charset <type> | Character set: unicode or ascii | unicode | | -h, --help | Show help | | | -V, --version | Show version | |

Programmatic API

import { render } from 'mermaid2term';

const diagram = `
graph TD
    A[Start] --> B{Decision}
    B -->|Yes| C[Do Something]
    B -->|No| D[Skip]
    C --> E[End]
    D --> E
`;

const output = render(diagram);
console.log(output);

API Reference

render(input: string, options?: RenderOptions): string

Renders a Mermaid diagram to ASCII/Unicode art.

Parameters:

  • input - Mermaid diagram source
  • options - Optional configuration object

Options:

interface RenderOptions {
  charset?: 'unicode' | 'ascii';  // Default: 'unicode'
  paddingX?: number;              // Horizontal padding between nodes (default: 4)
  paddingY?: number;              // Vertical padding between nodes (default: 2)
  borderPadding?: number;         // Padding inside node borders (default: 1)
}

Supported Diagram Types

Flowcharts

Full support for flowchart/graph diagrams:

graph TD
    A[Rectangle] --> B(Rounded)
    B --> C{Diamond}
    C -->|Yes| D[Result 1]
    C -->|No| E[Result 2]

Supported features:

  • Directions: TD/TB (top-down), LR (left-right), RL (right-left), BT (bottom-top)
  • Node shapes: rectangles [], rounded (), diamonds {}
  • Edge types: solid -->, dotted -..->, thick ==>
  • Edge labels: -->|label|
  • Cycles/back-edges (rendered with proper routing)
  • Semicolon syntax for single-line diagrams

Example:

echo 'graph LR; A-->B; B-->C; C-->A' | mermaid2term

Output:

┌───┐     ┌───┐     ┌───┐
│   │     │   │     │   │
│ A │─────► B │─────► C │
│   │     │   │     │   │
└─▲─┘     └───┘     └───┘
  │                   │
  └───────────────────┘

Sequence Diagrams

Basic support for sequence diagrams:

sequenceDiagram
    Alice->>Bob: Hello Bob
    Bob-->>Alice: Hi Alice

Character Sets

Unicode (default)

Uses Unicode box-drawing characters for crisp rendering:

┌───────┐
│ Node  │
└───────┘
    │
    ▼

ASCII

For terminals without Unicode support:

+-------+
| Node  |
+-------+
    |
    v

Examples

Decision Flow

echo 'graph TD
    Start --> Process
    Process --> Decision{Valid?}
    Decision -->|Yes| Success
    Decision -->|No| Error
    Error --> Process
    Success --> End' | mermaid2term

Horizontal Flow

echo 'graph LR
    Input --> Process
    Process --> Output' | mermaid2term

With Labels

echo 'graph TD
    A -->|step 1| B
    B -->|step 2| C
    C -->|step 3| D' | mermaid2term

Development

# Clone the repository
git clone https://github.com/watzon/mermaid2term.git
cd mermaid2term

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

# Development mode (watch)
npm run dev

License

MIT