layout-mermaid-diagram

Prevent node overlap and misalignment in Mermaid diagrams using layout-control techniques.

Updated Mar 2, 2019
One-click install
npx skills add https://github.com/trmaphi/dotfiles --skill layout-mermaid-diagram
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: layout-mermaid-diagram
Source: https://github.com/trmaphi/dotfiles/tree/main/.claude/skills/layout-mermaid-diagram
Command: npx skills add https://github.com/trmaphi/dotfiles --skill layout-mermaid-diagram

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Mermaid diagrams often suffer from node overlap and awkward spacing, making diagrams hard to read and explain. This Skill provides layout techniques to precisely control rendering without manual dragging.

Core Features & Use Cases

  • Invisible Anchor (~~~) keeps nodes on the same rank without drawing a line.
  • Arrow Length Hack (----) increases spacing along the main spine.
  • Node Definition Ordering to establish priority in top-to-bottom rendering.
  • Subgraph Force Fields to group related nodes and prevent external lines from weaving through them.
  • Multi-Node Connections to align several nodes on the same level.

Typical use cases include documentation diagrams, planning workflows, and architecture visuals where consistent spacing improves comprehension.

Quick Start

Create a Mermaid diagram that uses invisible anchors and arrow-length hacks to keep nodes aligned and evenly spaced.

Frequently Asked Questions about layout-mermaid-diagram

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent node overlap in Mermaid diagrams?

Prevent node overlap in Mermaid diagrams by applying layout-control techniques like invisible anchors, arrow-length hacks, and subgraph grouping to ensure predictable rendering and consistent spacing without manual dragging.

What is an invisible anchor in Mermaid and how does it work?

An invisible anchor in Mermaid uses the ~~~ syntax to keep nodes on the same rank without drawing a visible line, providing precise layout control to align elements and prevent misalignment in graph TD and graph LR diagrams.

How do I increase spacing between nodes in a Mermaid graph?

Increase spacing between nodes in a Mermaid graph by using the arrow-length hack with extended dashes like ----, which increases spacing along the main spine to improve diagram readability and comprehension.

Does node definition ordering affect top-to-bottom rendering in Mermaid?

Node definition ordering establishes priority in top-to-bottom rendering within Mermaid diagrams, allowing you to control the visual layout hierarchy and ensure predictable visual structures.

Can I group related nodes in Mermaid to stop external lines from weaving through?

Group related nodes using subgraph force fields in Mermaid to prevent external lines from weaving through the grouped nodes, maintaining a clean and organized diagram layout for documentation visuals.

What is the best way to align several nodes on the same level in Mermaid?

The best way to align several nodes on the same level in Mermaid is by using multi-node connections combined with invisible anchors, ensuring precise horizontal or vertical alignment across the diagram.