Template:Diagram: Difference between revisions

From RECESSIM, A Reverse Engineering Community
Jump to navigation Jump to search
Add style= parameter: per-embed Mermaid styling via <mermaid page=…>
m Protected "Template:Diagram": High-use template: admin-only edits to prevent site-wide damage (anti-vandalism) ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
 
(No difference)

Latest revision as of 20:48, 30 September 2026

Embeds a diagram that lives on its own page in one of the five diagram namespaces, so it can be inserted and repointed from the visual editor.

Usage: {{Diagram|page=Mermaid:RE FlowChart Overview}}

The page parameter is the full page name of the diagram, including its namespace prefix — Mermaid:, DOT:, Drawio:, BPMN: or Gantt:. See Help:Diagrams.

This template wraps the {{#display_diagram:}} parser function. The wrapper exists so the diagram name is a parameter: the visual editor can insert and change parameters, but has no way to edit a parser function's target, so a bare {{#display_diagram:}} call can only be changed by editing the page source. Bare calls still work and still render — prefer this template for anything new.

Per-embed styling (Mermaid only): {{Diagram|page=Mermaid:RE Microscope Workflow|style=style MW_Memory_File stroke-width:8px}} adds Mermaid statements to the end of the diagram for this embed only — the saved diagram and its other embeds are unchanged. Use the node's id (not its label), separate several statements with ;. A misspelled id is not an error: Mermaid just draws an extra empty node. With style set, this template uses <mermaid page="…"> (defined in LocalSettings.php) instead of {{#display_diagram:}}; it does nothing for DOT, Drawio, BPMN or Gantt pages, which show an error instead.

The {{#if:}} guard below is load-bearing: FDDisplayDiagram::run() passes its argument to Title::newFromText() and calls ->exists() on the result without a null check, so an empty page would throw a fatal error rather than render nothing.

Embed a diagram from the Mermaid, DOT, Drawio, BPMN or Gantt namespace.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Diagram pagepage

Full page name of the diagram, including the namespace prefix, e.g. Mermaid:RE FlowChart Overview

Example
Mermaid:RE FlowChart Overview
Page namerequired
Extra style (Mermaid only)style

Mermaid statements added to the end of the diagram for this embed only; the saved diagram page and its other embeds are unchanged. Use the node's id, not its label. Separate statements with ;

Example
style MW_Memory_File stroke-width:8px; style MW_Sample-Preparation fill:#ffd
Stringoptional