Help:Diagrams: Difference between revisions
Fix wrapped list items rendering as preformatted blocks |
Restructure: a section per format with an editable example, embed syntax and an editor screenshot slot |
||
| Line 1: | Line 1: | ||
This wiki can store '''diagrams as diagrams''' rather than as uploaded pictures. A | This wiki can store '''diagrams as diagrams''' rather than as uploaded pictures. A diagram lives on its own page, keeps a full edit history like any other page, and can be re-opened and changed by the next person — no hunting for the original file, and no re-uploading a flat image every time something moves. | ||
diagram lives on its own page, keeps a full edit history like any other page, and can be | |||
re-opened and changed by the next person — no hunting for the original file, and no | |||
re-uploading a flat image every time something moves. | |||
You need to be logged in and in the '''writer''' group to create or change a diagram. | You need to be logged in and in the '''writer''' group to create or change a diagram. Anyone can view them. | ||
Anyone can view them. | |||
''Screenshots of the editing interfaces are still to be uploaded. Each section below already points at the image it expects, so uploading a file under exactly the name shown will make it appear here automatically — no further editing of this page needed:'' <code>FlexDiagrams Mermaid editor.png</code>, <code>FlexDiagrams DOT editor.png</code>, <code>FlexDiagrams Drawio editor.png</code>, <code>FlexDiagrams BPMN editor.png</code>, <code>FlexDiagrams Gantt editor.png</code>. ''Delete this paragraph once they are all up.'' | |||
== Choosing a format == | |||
{| class="wikitable" | {| class="wikitable" | ||
! Namespace !! Best for !! How you edit it | ! Namespace !! Best for !! How you edit it | ||
|- | |- | ||
| | | [[#Mermaid|Mermaid:]] || Flowcharts, sequence diagrams, state machines, ER diagrams, timelines || Text — a few lines of Mermaid syntax | ||
|- | |- | ||
| | | [[#DOT|DOT:]] || Graphs and trees: signal chains, network maps, workflows || Text — Graphviz DOT syntax | ||
|- | |- | ||
| | | [[#Drawio|Drawio:]] || Free-form drawings, block diagrams, anything you want to drag around || Full visual editor (draw.io / diagrams.net) | ||
|- | |- | ||
| | | [[#BPMN|BPMN:]] || Formal process diagrams, with elements that can link to wiki pages || Visual editor | ||
|- | |- | ||
| | | [[#Gantt|Gantt:]] || Project schedules with dependencies || Visual editor | ||
|} | |} | ||
'''Mermaid''' and '''DOT''' are the two most useful here for typical hardware, RF and | '''Mermaid''' and '''DOT''' are the two most useful here for typical hardware, RF and reverse-engineering documentation, and they are the easiest to review in a diff because the source is plain text. | ||
reverse-engineering documentation, and they are the easiest to review in a diff because | |||
the source is plain text. | |||
== Creating a diagram == | == Creating a diagram == | ||
| Line 37: | Line 31: | ||
# The diagram editor opens directly. Fill it in and save. | # The diagram editor opens directly. Fill it in and save. | ||
You can also go straight to the editor for a page that does not exist yet by visiting | You can also go straight to the editor for a page that does not exist yet by visiting its URL with <code>?action=editdiagram</code> on the end. | ||
its URL with <code>?action=editdiagram</code> on the end. | |||
On a diagram page that already exists, use the '''Edit diagram''' tab at the top. | On a diagram page that already exists, use the '''Edit diagram''' tab at the top. | ||
| Line 44: | Line 37: | ||
== Showing a diagram on another page == | == Showing a diagram on another page == | ||
Diagram pages are not transcluded with the usual double braces. Use the | Diagram pages are '''not''' transcluded with the usual double braces. Use the <code>#display_diagram</code> parser function instead, naming the diagram page including its namespace: | ||
<code>#display_diagram</code> parser function instead: | |||
<pre> | <pre> | ||
| Line 51: | Line 43: | ||
</pre> | </pre> | ||
That renders the diagram inline wherever you put it, so an article can show a diagram | That renders the diagram inline wherever you put it, so an article can show a diagram that is maintained on its own page. Each section below gives the exact line for that format's example. | ||
that is maintained on its own page. | |||
== Mermaid | == Mermaid == | ||
Flowcharts, sequence diagrams, state machines, class and ER diagrams, pie charts and timelines, all written as text. Served entirely from this wiki. | |||
'''Example page:''' [[Mermaid:Example diagram]] — [{{fullurl:Mermaid:Example diagram|action=editdiagram}} open it in the editor] | |||
Its source is simply: | |||
<pre> | <pre> | ||
| Line 65: | Line 60: | ||
C -->|no| E[Adjust gain / freq] | C -->|no| E[Adjust gain / freq] | ||
E --> B | E --> B | ||
</pre> | |||
Embed it in a page with: | |||
<pre> | |||
{{#display_diagram:Mermaid:Example diagram}} | |||
</pre> | </pre> | ||
| Line 71: | Line 72: | ||
{{#display_diagram:Mermaid:Example diagram}} | {{#display_diagram:Mermaid:Example diagram}} | ||
See [https://mermaid.js.org/intro/ the Mermaid documentation] for the full syntax. Note that this wiki bundles '''Mermaid 10.9''', so diagram types added in Mermaid 11 will not render. | |||
[https://mermaid.js.org/intro/ the Mermaid documentation] for the full syntax. Note that | [[File:FlexDiagrams Mermaid editor.png|thumb|none|700px|The Mermaid editor: type the diagram source in the text box and the preview above it redraws as you type.]] | ||
this wiki bundles '''Mermaid 10.9''', so diagram types added in Mermaid 11 will not | |||
== DOT == | |||
Graphviz DOT source, rendered in your browser by the bundled Viz.js. You describe what connects to what and Graphviz works out the layout. Served entirely from this wiki. | |||
'''Example page:''' [[DOT:Example diagram]] — [{{fullurl:DOT:Example diagram|action=editdiagram}} open it in the editor] | |||
Its source: | |||
<pre> | <pre> | ||
| Line 93: | Line 96: | ||
</pre> | </pre> | ||
Embed it in a page with: | |||
<pre> | |||
{{#display_diagram:DOT:Example diagram}} | |||
</pre> | |||
which renders as: | |||
{{#display_diagram:DOT:Example diagram}} | {{#display_diagram:DOT:Example diagram}} | ||
DOT | [[File:FlexDiagrams DOT editor.png|thumb|none|700px|The DOT editor: Graphviz source in the text box, with the rendered graph above it.]] | ||
== Drawio == | |||
The full draw.io drawing tool, for free-form diagrams you build by dragging shapes around. Good when the layout itself carries meaning — panel layouts, wiring sketches, block diagrams. | |||
'''Example page:''' [[Drawio:Example diagram]] — [{{fullurl:Drawio:Example diagram|action=editdiagram}} open it in the editor] | |||
Embed it in a page with: | |||
<pre> | |||
{{#display_diagram:Drawio:Example diagram}} | |||
</pre> | |||
which renders as: | |||
{{#display_diagram:Drawio:Example diagram}} | |||
'''One thing to know:''' the Drawio editor is loaded from the external site <code>embed.diagrams.net</code> while you are editing. Your diagram is saved here on the wiki, not on their servers, and viewing a saved Drawio diagram does not contact them at all — but ''editing'' one needs that external site reachable from your browser. The other four formats are served entirely from this wiki. | |||
[[File:FlexDiagrams Drawio editor.png|thumb|none|700px|The Drawio editor: the full draw.io canvas, shape palette and format panel, embedded in the wiki page.]] | |||
== BPMN == | |||
Formal business-process diagrams, drawn with bpmn-js. Worth knowing: an element named <code><nowiki>[[Some page]]</nowiki></code> becomes a link to that wiki page, so a process diagram can double as navigation. | |||
'''Example page:''' [[BPMN:Example diagram]] — [{{fullurl:BPMN:Example diagram|action=editdiagram}} open it in the editor] | |||
Embed it in a page with: | |||
<pre> | |||
{{#display_diagram:BPMN:Example diagram}} | |||
</pre> | |||
which renders as: | |||
{{#display_diagram:BPMN:Example diagram}} | |||
[[File:FlexDiagrams BPMN editor.png|thumb|none|700px|The BPMN editor: the shape palette down the left, canvas in the middle, zoom controls on the right.]] | |||
== Gantt == | |||
Project schedules with tasks, durations and dependencies, drawn with dhtmlxGantt. Useful for planning a long teardown or a multi-stage project on its own page. | |||
'''Example page:''' [[Gantt:Example diagram]] — [{{fullurl:Gantt:Example diagram|action=editdiagram}} open it in the editor] | |||
Embed it in a page with: | |||
<pre> | |||
{{#display_diagram:Gantt:Example diagram}} | |||
</pre> | |||
which renders as: | |||
{{#display_diagram:Gantt:Example diagram}} | |||
[[File:FlexDiagrams Gantt editor.png|thumb|none|700px|The Gantt editor: task grid on the left, timeline on the right, with zoom controls for hours through years.]] | |||
the | |||
== Tips == | == Tips == | ||
| Line 112: | Line 168: | ||
* Diagrams are ordinary pages: <code>History</code>, <code>Talk</code>, watchlisting and the normal backups all apply. | * Diagrams are ordinary pages: <code>History</code>, <code>Talk</code>, watchlisting and the normal backups all apply. | ||
* Because Mermaid and DOT are text, their page histories produce readable diffs — prefer them over an uploaded image when the diagram is likely to change. | * Because Mermaid and DOT are text, their page histories produce readable diffs — prefer them over an uploaded image when the diagram is likely to change. | ||
* Give diagrams descriptive names, the same as files — <code>Mermaid:Landis Gyr Focus teardown steps</code> beats <code>Mermaid:Diagram 3</code>. | * Give diagrams descriptive names, the same as files — <code>Mermaid:Landis Gyr Focus teardown steps</code> beats <code>Mermaid:Diagram 3</code>. | ||
* The five example pages above are meant to be edited and experimented with. If you want a scratch diagram of your own, make a new page rather than overwriting an example. | |||
== See also == | == See also == | ||