Tools / Editor

Pele Formatter: Tidy Diagram Source

Format supported Pele source with consistent indentation. Preserve the parsed diagram, review errors and copy the result without changing labels.

What formatting changes and preserves

Make supported diagram source easier to read with consistent indentation. Use the formatter before a documentation review or after several manual edits. Formatting is a source-code cleanup step: it should preserve the model, labels, and relationships rather than redesign the diagram.

A worked example

Input

flowchart TD
A[Request] --> B{Valid?}
B -->|Yes| C[Accept]
B -->|No| D[Reject]

Diagram source

flowchart TD
  A[Request] --> B{Valid?}
  B -->|Yes| C[Accept]
  B -->|No| D[Reject]
The request decision has two labeled branches. Indentation makes the block easier to scan while keeping the same nodes, labels, and connections.

How to use this tool

  1. Paste diagram source that already parses. Start with the example if you want to see the expected input.
  2. Select Format. Review any error before replacing your original text.
  3. Compare the result, then copy or download the formatted source. Keep a source diff when the change belongs in a repository.

What to check

DetailGuidance
Formatted blocksCommon flowchart, sequence, class, state, and ER blocks receive indentation.
Preserved contentQuoted text and other diagram types are preserved. Whitespace inside a label can be meaningful.
Model preservationThe parsed diagram must remain unchanged. Unsupported input or a model change is reported without replacing the original.

Common questions

Can formatting repair an invalid diagram?

No. Fix the syntax first: check the diagram declaration, delimiters, and control-block endings. The formatter is not a parser-error fixer or an automatic upgrade to newer Mermaid syntax.