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

@reponova/lang-mermaid

v0.1.1

Published

Mermaid diagram support for RepoNova

Readme

@reponova/lang-mermaid

Mermaid diagram support for RepoNova. Regex-based line-by-line parser — no tree-sitter grammar required.

Install

reponova lang add @reponova/lang-mermaid

What it extracts

The extractor recognises the diagram family from the first non-blank, non-comment line and dispatches to a per-family handler. Across families it emits one of:

  • File node: always kind: "diagram", tagged ["mermaid", "<family>"]. The file docstring is the YAML-frontmatter title: if present, otherwise the inline title directive.
  • Symbols: per-family entities (nodes, participants, classes, states, …) with the originating Mermaid keyword preserved as the first decorator so consumers can filter by family.
  • References: edges between symbols, projected onto the extends / references edge types from the RepoNova edge vocabulary.

Supported diagram families

| Family | Header | Symbols | Edges | |---|---|---|---| | Flowchart / graph | flowchart …, graph … | every node id (with the shape captured as a secondary decorator: circle, diamond, cylinder, hexagon, stadium, subroutine, trapezoid, …); subgraph blocks become module-kind containers, nested nodes carry parent | every arrow as a references edge, plus edge endpoints promoted to default-rectangle nodes when no explicit declaration exists | | Sequence | sequenceDiagram | actor / participant declarations by alias (display label kept as docstring); implicit participants promoted from arrows (decorator ["participant", "implicit"]) | messages as references | | Class / class-v2 | classDiagram, classDiagram-v2 | classes, <<interface>> / <<abstract>> / <<enumeration>> stereotypes (interfaces become kind: "interface"); inside-block members split into method (with paren signature) and variable (field) with visibility decorators public/private/protected/package | <\|--, <\|.. produce extends (with direction normalised so the child points at the parent); other arrows become references | | State / state-v2 | stateDiagram, stateDiagram-v2 | explicit state X and state "Display" as X declarations; <<choice>> / <<fork>> / <<join>> stereotypes; transition endpoints promoted to implicit states (decorator ["state", "implicit"]); the [*] pseudostate is intentionally NOT a symbol | transitions as references | | ER | erDiagram | entities as class-kind symbols; attributes inside { … } blocks as variable children carrying the type as docstring and PK / FK / UK constraints as secondary decorators | relations as references, with the relation label attached to the source entity as a docstring fallback | | Gantt | gantt | section declarations as section-kind symbols; tasks as children of the most recent section | (none — Gantt has no cross-references) | | Journey | journey | sections + tasks (with actor lists kept inside the task docstring) | (none) | | GitGraph | gitGraph | commits (id or auto-generated c<n>) as children of the current branch; branches as module-kind symbols | merge lines as references between branches | | Pie | pie | each "slice" : value as a pie_slice symbol with name = value in the docstring | (none) | | Mindmap | mindmap | hierarchical via indentation; node identifier preserved, shape stored as secondary decorator (circle, rounded, rectangle, hexagon, subroutine, bang) | (none — parent is the structural edge) | | Timeline | timeline | sections + periods + events with parent relationships | (none) | | C4 | C4Context, C4Container, C4Component, C4Deployment, C4Dynamic | Person, System, Container, Component, Boundary, Deployment_Node, … macros (each keyword preserved as c4_<macro> decorator) | Rel, BiRel, Rel_U/D/L/R, Rel_Back, Rel_Neighbor as references | | Requirement | requirementDiagram | requirement / functionalRequirement / interfaceRequirement / … as interface-kind symbols; element as component-kind | relations (contains, derives, satisfies, verifies, refines, traces, copies) as references | | Zenuml | zenuml | @Actor, @Database, @Boundary, @Control, @Entity, @Queue, @EC2, @S3, @RDS, @LB, @Internet, @Lambda annotators | A -> B arrows as references | | (unknown) | anything else | none — still produces a valid fileNode tagged ["mermaid", "unknown"] | (none) |

Extensions

.mmd, .mermaid

Configuration

In reponova.yml:

plugins:
  mermaid:
    enabled: true       # default: true
    # patterns: []      # override global patterns for Mermaid files
    # exclude: []       # override global exclude for Mermaid files

| Property | Type | Default | Description | |----------|------|---------|-------------| | enabled | boolean | true | Enable/disable Mermaid file detection and extraction | | patterns | string[] | [] | Glob patterns to override global file matching for this plugin | | exclude | string[] | [] | Glob patterns to override global exclusions for this plugin |

Resolution semantics

  • No imports: Mermaid files do not reference each other; resolveImportPath is a hard no-op that always returns [].
  • Frontmatter handling: a YAML --- block at the very top of the file is stripped before parsing. If it contains a title: key, the value becomes the file's docstring (taking precedence over any inline title directive). All other frontmatter keys are ignored.
  • %%{init: …}%% directives: the initial config directive is stripped wholesale (including multi-line forms) before family detection — its body is JSON-shaped configuration, not Mermaid syntax.
  • %% comments: standalone comment lines are skipped per family. End-of-line comments inside other syntactic constructs are not stripped — they are typically tolerated by the per-family regexes.
  • Edge direction: in class diagrams, arrows whose head is on the left (<--, <.., <|--, <|..) have their source and target swapped so the resulting edge always points "child → parent" in graph terms. This matches the way RepoNova's extends edges are interpreted.
  • Identifier collisions: a symbol is added only once per (parent, name) key. The first declaration wins; later mentions on relationship lines do not duplicate it.

License

MIT — see LICENSE.