mermaid
mermaid copied to clipboard
allow new line when writing mermaid
flowchart TB
a["Proin_elementum_magna"] --> b["quis_enim_porta_congue<br>Orci_varius_natoque"] \
c["penatibus_et_magnis_dis"] --> \
e["parturient_montes_<br> \
nascetur_ridiculus_mus.<br> \
Vivamus eu_eros vitae<br> \
risus_fringilla_sagittis."]
Today we have to write
flowchart TB
a["Proin_elementum_magna"] --> b["quis_enim_porta_congue<br>Orci_varius_natoque"] c["penatibus_et_magnis_dis"] --> e["parturient_montes_<br> nascetur_ridiculus_mus.<br> Vivamus eu_eros vitae<br> risus_fringilla_sagittis."]
"\" to continue line could be a good solution
you can use \n
instead of <br>
you can use
\n
instead of<br>
The request here is not to have new lines in mermaid rendering but to allow to have some \
line continue writing the source coden to have a more easy to read code
You could always do something like this:
flowchart TB
a["
Proin_elementum_magna"] --> b["
quis_enim_porta_congue<br>Orci_varius_natoque"]
c["
penatibus_et_magnis_dis"] --> e["
parturient_montes_<br> nascetur_ridiculus_mus.<br> Vivamus eu_eros vitae<br> risus_fringilla_sagittis."]
Now that I am re-reading this - I am confused. Where are you creating diagrams that you need to do everything on one line? Because this:
flowchart TB
a["Proin_elementum_magna"] --> b["quis_enim_porta_congue<br>Orci_varius_natoque"]
c["penatibus_et_magnis_dis"] -->
e["parturient_montes_<br>
nascetur_ridiculus_mus.<br>
Vivamus eu_eros vitae<br>
risus_fringilla_sagittis."]
Works fine
https://mermaid.ink/svg/pako:eNqdks9OwkAQxl-lmXMh0GKBxnAwXo0mGg9asxnaaZmkuwv7B0XCuztFfACZ02Zmvt982Zkj1LYhKKHt7We9QReSl7vKJAm-V_DkLBtFPWkyIWqlsTNYwUcyGq2StTTsIntFhrXaWhdQ1dZ0kW7XbvXoalZ7dBy9MhjsLpIIB3Atui1JjtdSo3CmCqZh_4f-bwxYGrBiPzoWs0pbE8irwUpyZQxUCYO-JsEqxw3XsRfTOvrxleQL9JX3KJSEoiJnfbLngHS12QvUsRdzrWPTcd-j8thxCOzH8q-QgiankRvZ9XEQVBA2stgKSnk21GLsQwWVOUkrxmCfD6aGMrhIKcRtg4HuGTuHGsoWey_ZLRooj_AFZVaMs2K-mOTTZTbNF8U8S-EA5TSbjZezeZEvZ8VNnmeT_JTCt7WCmKZADQfrHn7P73yFZ-TbuT7MPf0AbjS1iQ
It seems that sequence diagram notes is one place where newlines can't be used within quotations.
What works:
sequenceDiagram
participant A
participant B
Note over A: Required variables: <br/> source id <br/> target id <br/> user <br/> group <br/> origin
A->>B: make_request()
What I'd actually like to use:
sequenceDiagram
participant A
participant B
Note over A: "
Required variables: <br/>
source id <br/>
target id <br/>
user <br/>
group <br/>
origin"
A->>B: make_request()
I love the idea of mermaid diagrams - to have easily editable graphical content within markdown documentation. However, not being able to use line breaks in the source code makes any diagram that's a bit more complex very hard to read and manage, which kind of beats the original purpose.