To create a codeblock we encapsulate the text within triple-backticks ```
like so:
```
code or output goes in here
```
To follow a certain syntax, we specify it after the opening triple-backticks.
An example for non-colored-coded plain text:
```text
plain text, output, or other non-colored-coded text
goes in here
```
An example for bash:
```bash
#!/bin/bash
while true; do echo “Hello World”; sleep 10; done
exit
To create a simple graph or flowchart, invoke the Mermaid plugin.
```mermaid
graph or flowchart created in here
```
IMPORTANT NOTE: Unlike blocks of code, the Mermaid plugin is frustratingly “quirky” if you use the preview panel on the right side of the screen. It is recommended to attempt to create a flowchart “blind”, with the preview panel temporarily disabled. This will give you better control of your text and cursor, and prevent an “auto” resize being applied, which will “crop out” the chart. (Otherwise, you will have to fight with the plugin as it tries to intelligently auto-complete and interfere with your typing.)
If you wish to incorporate “colors”, keep in mind that the chart may not appear legible to other readers using a different forum “theme”.
The following are simple examples that you can use as templates
In a sense, you declare objects by first creating them, which allows you to invoke them as “variables” by using their “names”. Objects can connect to each other with “lines”. That is the gist of it.
The desired “shapes” are created by specifying characters (or combinations of characters) after the object’s name. Such characters include [ ]
, ( )
, [( )]
, { }
, and so on.
The desired type of graph, chart, or diagram is specified immediately after invoking the plugin, such as this example for a “top-down” flowchart:
```mermaid
flowchart TD
Or for a “left-right” flowchart:
```mermaid
flowcart LR
Or for a Gantt time chart:
```mermaid
gantt
NOTE: The Mermaid plugin is very advanced. It supports different shapes, colors, strokes, styles, and so on. However, for the sake of these examples, I will try to avoid fine-grain complexities.
A simple “top-down” flowchart:
```mermaid
flowchart TDuser1(Admin)
choice1{“Destroy\nServer?”}
result1[“Arrested for\ndestruction of\nproperty”]
result2[“Arrested for\nnot protecting\ncustomer data”]user1 → choice1
choice1 -->|YES| result1
choice1 -->|NO| result2
```
flowchart TD
user1(Admin)
choice1{"Destroy\nServer?"}
result1["Arrested for\ndestruction of\nproperty"]
result2["Arrested for\nnot protecting\ncustomer data"]
user1 --> choice1
choice1 -->|YES| result1
choice1 -->|NO| result2
A simple “left-to-right” graph:
```mermaid
flowchart LRnas1[(“Main\nNAS”)]
nas2[(“Backup\nNAS”)]
dsDocs(“Documents\nDataset”)
dsDocsBak(“Docs Dataset\n(backup)”)
dsDLs(“Downloads\nDataset”)nas1 — dsDocs
nas1 — dsDLs
nas2 — dsDocsBak
dsDocs -…->|DAILY\nREPLICATION| dsDocsBakstyle note fill:lightyellow,color:black
note>“My DLs are saved\non another USB”]
```
flowchart LR
nas1[("Main\nNAS")]
nas2[("Backup\nNAS")]
dsDocs("Documents\nDataset")
dsDocsBak("Docs Dataset\n(backup)")
dsDLs("Downloads\nDataset")
nas1 --- dsDocs
nas1 --- dsDLs
nas2 --- dsDocsBak
dsDocs -..->|DAILY\nREPLICATION| dsDocsBak
style note fill:lightyellow,color:black
note>"My DLs are saved\non another USB"]
You can also use “colors”. Although, you should consider other readers who are using different forum themes. It might be wise to only change the “border” color or thickness.
```mermaid
flowchart LRstyle result1 stroke:green,stroke-width:4px
style result2 stroke:red,stroke-width:4pxuser1(Admin)
choice1{“Create\nBackups?”}
result1[“Happy\nlife”]
result2[“Eventually\nlose everything”]user1 → choice1
choice1 -->|YES| result1
choice1 -->|NO| result2
```
flowchart LR
style result1 stroke:green,stroke-width:4px
style result2 stroke:red,stroke-width:4px
user1(Admin)
choice1{"Create\nBackups?"}
result1["Happy\nlife"]
result2["Eventually\nlose everything"]
user1 --> choice1
choice1 -->|YES| result1
choice1 -->|NO| result2
To learn more about Mermaid’s syntax, read the documentation on their website.
There is also a helpful cheat sheet.