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

mermaid-validate

v1.3.2

Published

A CLI to validate mermaid diagrams

Downloads

627

Readme

Mermaid Validate CLI

A command-line tool to validate Mermaid diagrams.

📖 Development Guide - Setup, architecture, CI/CD, and contributing information

Installation

npm install mermaid-validate -g

Usage

Validate from File

mermaid-validate validate <filePath> [options]

Validate from String

mermaid-validate validate "<diagram-string>" --string [options]

Validate Markdown File

mermaid-validate validate-md <markdown-file> [options]

Using NPX (Recommended)

# Validate file
npx mermaid-validate validate <filePath> [options]

# Validate string
npx mermaid-validate validate "<diagram-string>" --string [options]

Examples

# Validate a diagram file
mermaid-validate validate diagram.mmd

# Validate a diagram string directly
mermaid-validate validate "flowchart TD; A-->B;" --string

# Using NPX with file
npx mermaid-validate validate flowchart.mmd

# Using NPX with string
npx mermaid-validate validate "sequenceDiagram; A->>B: Hello" --string

# Specify diagram type (optional)
mermaid-validate validate "pie title Pets; Dogs: 50; Cats: 30" --string --type pie

# Validate all Mermaid diagrams in a Markdown file
mermaid-validate validate-md README.md

# Validate with fail-fast (stop on first error)
mermaid-validate validate-md docs/architecture.md --fail-fast

# Using NPX with markdown
npx mermaid-validate validate-md documentation.md

Programmatic Usage

import { validate } from 'mermaid-validate';

const result = await validate('flowchart TD; A-->B;', 'flowchart');
console.log(result); // { isValid: true }

const invalidResult = await validate('flowchart TD; A--B;', 'flowchart');
console.log(invalidResult); // { isValid: false, error: "..." }

Supported Diagram Types

The validator supports all Mermaid diagram types including:

  • Flowcharts
  • Sequence diagrams
  • Class diagrams
  • State diagrams
  • Entity relationship diagrams
  • User journey diagrams
  • Gantt charts
  • Pie charts
  • Git graphs
  • And more...

Corporate Environment Support

This CLI includes automatic support for corporate NPM registries. If you're working in a corporate environment where packages are downloaded from internal registries, the tool can automatically fix package-lock.json files to use public NPM registry URLs.

Quick Setup

  1. Copy the environment template:

    cp .env.example .env
  2. Edit .env with your corporate registry URL:

    CORPORATE_REGISTRY=https://your-company.com/npm/
  3. The pre-commit hook will automatically fix registry URLs when you commit.

For detailed configuration options, see DEVELOPMENT.md.

Development

For development setup, architecture details, CI/CD configuration, and contributing guidelines, see DEVELOPMENT.md.

Quick start for developers:

git clone [email protected]:cloud-on-prem/mermaid-validator.git
cd mermaid-validator
npm install
npm test

License

Apache 2.0