Skip to content
PluginStats

mermaid-formatter weekly downloads statistics

By chenyanchen · npm · Prettier plugins

A formatter for Mermaid diagram syntax

View on npm Fresh · Dec 6, 2026

mermaid-formatter has 891 recorded weekly downloads on npm, an increase of 67.2% over the past 30 days, ranking #2106 of 3,247 tracked listings.

Weekly downloads
891
Official API · Dec 5, 2026
7-day growth
+145%
+527 weekly downloads
30-day growth
+67.2%
+358 weekly downloads
90-day growth
+284%
+659 weekly downloads
Rank
#2106
▲ 128 in 7 days

About mermaid-formatter

mermaid-formatter

A formatter for Mermaid diagram syntax.

Features

  • Format all Mermaid diagram types (sequenceDiagram, flowchart, classDiagram, etc.)
  • Normalize indentation and whitespace
  • Format Mermaid code blocks in Markdown
  • CLI tool and programmatic API
  • Zero dependencies (lightweight)

Installation

# Global install (recommended for CLI usage)
npm install -g mermaid-formatter

Usage

CLI
# Format file to stdout
mermaidfmt diagram.mmd

# Format file in-place
mermaidfmt -w diagram.mmd

# Format from stdin
echo "sequenceDiagram
  A->>B: hello" | mermaidfmt

# Custom indent (default: 4 spaces)
mermaidfmt --indent 2 diagram.mmd

# Use tabs instead of spaces
mermaidfmt --tabs diagram.mmd
Prettier Plugin
npm install -D prettier mermaid-formatter
// .prettierrc
{
  "plugins": ["mermaid-formatter/prettier-plugin"]
}
# Format Mermaid files
npx prettier --write "**/*.mmd"

# Mermaid fenced code blocks in Markdown are also formatted
npx prettier --write "**/*.md"
Programmatic API
import { formatMermaid, formatMarkdownMermaidBlocks } from 'mermaid-formatter';

// Format Mermaid code
const input = `sequenceDiagram
      participant A
        A->>B:  Hello`;

const formatted = formatMermaid(input);
// Output:
// sequenceDiagram
//     participant A
//     A ->> B: Hello

// With options
const formatted2 = formatMermaid(input, { indentSize: 2, useTabs: false });

// Format Mermaid blocks in Markdown
const markdown = `
# My Document

\`\`\`mermaid
sequenceDiagram
  A->>B: hello
\`\`\`
`;

const formattedMarkdown = formatMarkdownMermaidBlocks(markdown);
API Reference
formatMermaid(input: string, options?: FormatOptions): string

Format Mermaid diagram source code.

Options:

  • indentSize (number, default: 4) - Number of spaces for indentation
  • useTabs (boolean, default: false) - Use tabs instead of spaces
formatMarkdownMermaidBlocks(markdown: string, options?: FormatOptions): string

Format all Mermaid code blocks in a Markdown document.

parse(input: string): Diagram

Parse Mermaid source into an AST.

detectDiagramType(input: string): DiagramType

Detect the diagram type from source code.

Formatting Rules

  • Diagram declaration at column 0
  • Block keywords (critical, alt, loop, par, opt, break, rect, subgraph, end) indented based on nesting depth
  • Block continuations (else, option, and) at same level as their opening block keyword
  • Content inside blocks indented by configured amount
  • Consecutive blank lines collapsed to single blank line
  • Trailing blank lines removed
  • Blank line inserted before block starts
  • Arrow messages normalized when line matches from ARROW to: message pattern (A->>B:msg → A ->> B: msg)
  • Flowchart class syntax is preserved (A --> B:::warning is not treated as arrow message)
  • Whitespace normalized (multiple spaces → single, bracket padding removed)

Supported Diagram Types

  • sequenceDiagram
  • flowchart / graph
  • classDiagram
  • stateDiagram / stateDiagram-v2
  • erDiagram
  • journey
  • gantt
  • pie
  • quadrantChart
  • requirementDiagram
  • gitGraph
  • mindmap (preserved, indent-sensitive)
  • timeline (preserved, indent-sensitive)
  • sankey-beta
  • xychart-beta
  • block-beta
  • architecture-beta

Editor Integration

See Integrations Guide for:

  • VS Code setup (tasks, run-on-save)
  • Pre-commit hooks
  • GitHub Actions
  • Prettier plugin

Contributing

Issues and PRs welcome! See GitHub Issues.

License

MIT

Description from the npm listing.

  • mermaid
  • formatter
  • prettier
  • prettier-plugin
  • diagram
  • markdown
  • sequence-diagram
  • flowchart
  • ast

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

mermaid-formatter weekly downloads on npm, last 90 days: 891 weekly downloads as of Dec 5, 2026, +284% over 90 days.mermaid-formatterWeekly downloads on npm · Last 90 days891downloads / week+284% over 90 days05001K1.5K2KSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
mermaid-formatter weekly downloads on npm, last 90 days: 891 weekly downloads as of Dec 5, 2026, +284% over 90 days.

7/30/90-day growth

mermaid-formatter weekly downloads growth on npm: +145% over 7 days, +67.2% over 30 days, +284% over 90 days.mermaid-formatterWeekly downloads growth on npm891downloads / week now7-day growth+527 weekly downloads+145%30-day growth+358 weekly downloads+67.2%90-day growth+659 weekly downloads+284%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
mermaid-formatter weekly downloads growth on npm: +145% over 7 days, +67.2% over 30 days, +284% over 90 days.

Ranking history

mermaid-formatter npm ranking history: currently #2106 (by weekly downloads).mermaid-formatternpm ranking · by weekly downloads · Last 90 days#2106current rank#1500#1600#1700#1800#1900#2000#2100#2200#2300Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
mermaid-formatter npm ranking history: currently #2106 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,084 shown · page 106, #6 (overall #2,106)
All npm: every listing in weekly downloads order

Listing placement

Prettier plugins267 listings · 14 pages · page 3, #3 (overall #43)
Prettier plugins: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (170)
Recent weekly downloads observations for mermaid-formatter
Date (UTC)Weekly downloadsChange vs. previous
891+77
814+189
625+47
578+191
387-38
425+55
370+6
364-7
371-22
393-18
411-84
495-68
563-67
630—

Similar npm Prettier plugins plugins

All 20 mermaid-formatter alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/mermaid-formatter. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.