Skip to content

SourceCode/mermaid-linter

Repository files navigation

MermaidGuard (mermaid-linter)

MermaidGuard is a comprehensive linting, validation, and accessibility tool for Mermaid diagrams embedded within Markdown documentation. It allows engineering teams to enforce syntax correctness and accessibility standards (WCAG) across their documentation base, ensuring that diagrams are both valid and inclusive.

Key Capabilities

  • Syntax Validation: Validates Mermaid diagram syntax using the official Mermaid parser.
  • Accessibility (A11y): Enforces WCAG compliance (e.g., required titles and descriptions) for diagrams.
  • Autofix: Automatically repairs common issues (e.g., injecting missing accessibility tags) with --fix.
  • Configurable: Flexible configuration via .mermaidguardrc or package.json.
  • CI/CD Ready: Strict mode and exit codes designed for pipeline integration.

Quick Start

Installation

# Install via pnpm (recommended)
pnpm add -D @mermaidguard/cli

# Or run directly with npx
npx mermaidguard "**/*.md"

Basic Usage

Run the linter on all Markdown files in your project:

npx mermaidguard

Fix accessibility issues automatically:

npx mermaidguard --fix

Documentation

Full documentation is available in the docs/ directory:

Tech Stack

  • Runtime: Node.js v20+
  • Language: TypeScript
  • Package Manager: pnpm (Monorepo)
  • Testing: Vitest
  • Linting: ESLint + Prettier
  • Core Dependencies: mermaid, unified, commander, zod

Contributing

We welcome contributions! Please see CONTRIBUTING.md for details on our development workflow, submitting PRs, and coding standards.

License

Copyright (c) 2026. All rights reserved. (See Action Items).

About

A linter for mermaid charts

Resources

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors