Template:Category/Guide/workflow diagram

From Miniscope
Jump to: navigation, search

Renders the workflow graph for a Category:Guide page.

Invoked by Template:Category/Guide when the guide participates in a workflow. Two modes:

  • mode=full — the page is acting as a workflow container (its
 children declare prerequisites between themselves). The full graph
 of children + edges is rendered at full width. Used on the workflow's
 landing/overview page.
  • mode=you-are-here — the page is one node of someone else's
 workflow. The same graph is rendered, with the current node highlighted
 via mermaid classDef so the reader can see where they are.
 The container's CSS makes this variant render as a right-floating sidebox.

Parameters:

  • page — the page being rendered. Defaults to Template:Category/Guide/workflow diagram.
  • modefull or you-are-here. Defaults to
 full if omitted.
  • root — the workflow root page. For mode=full this equals
 page; for mode=you-are-here this is the value of
 page's Has parent guide. The caller is responsible
 for resolving root and passing it in — this template does not detect mode.

Mermaid rendering caveats

Pinned here so they don't get rediscovered the hard way:

  • The
    block body must start with a literal newline,
 otherwise the parser sees the first node on the wiki-marker line and fails.
  • config.securityLevel=loose is required for click
 handlers to fire — without it, mermaid renders the diagram but the nodes
 are not clickable.
  • The inner #ask uses link=none so SMW doesn't wrap
 page names in ... markers that the mermaid parser would
 choke on.
  • import-annotation=yes prevents SMW from injecting
 / guards around the
 template output that would break the mermaid block.
  • Mermaid does not render in preview — you must save the page to see the
 graph. This is a Mermaid extension quirk, not anything we control.

The edge query lives in Template:Category/Guide/edge; that template handles per-node emission (declaration + edges + click handler). Mermaid node IDs come from g0 — see the edge template's noinclude for why other slugification approaches (sub-templates with #replace, ) don't work in this context.

The inner #ask queries all direct children of the workflow root, not only those with Has prerequisite guide set. This ensures starting nodes (no prereqs) still get a node declaration and a click handler in the graph.

config.flowchart.useMaxWidth=true is intentionally omitted — the Mermaid extension's argument parser doesn't recognize the 3-level dotted config key and it leaks into the diagram content, breaking the syntax. config.securityLevel=loose works (2-level dotted key).