mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
71.3k stars 6.43k forks source link

Support note text that spans multiple lines in sequence diagram #2199

Open 51ngul4r1ty opened 3 years ago

51ngul4r1ty commented 3 years ago

Is your feature request related to a problem? Please describe. I would like to be able to have a long text span multiple lines. PlantUML solved this with use of embedded \n to force a new line.

Describe the solution you'd like I would like the ability to have a note span multiple lines using either 1) embedded \n character sequence in the note text; OR 2) note syntax that would allow text to span multiple lines (something like "begin note", note text over multiple lines and then "end note" - I won't define exactly how this should look because I feel it is up to the implementor to define this)

Describe alternatives you've considered The alternatives are defined above.

Additional context No additional context.

dry4ng commented 3 years ago

Same.

benallred commented 2 years ago

Potential workaround: <br/>

At least it worked for me while previewing markdown/mermaid in VS Code.

tekener commented 2 years ago

As a user coming from plantuml the only thing i disliked with mermaid❤️ was the "one-liner" note syntax. I had some notes spanning 5-10 lines. Putting them all into one line using
makes the note render, but the markdown is unreadable with that. Also when using the
syntax the text is centered what i would not expected here (Miro, Plant, etc are aligning text inside notes on the left). Maybe an additional alignment tag would help here (but that is maybe an other feature request).

Example:

note over Actor: Sends the data fields: name=Max<br/>method=push<br/>cause=creation. All the fields are later handled by the Field-Service.  

vs possible multiline solution:

note over Actor: 
Sends the data fields: 
name=Max
method=push
cause=creation.

All the fields are later handled by the Field-Service. 
endnote 
mkatychev commented 2 years ago

Would using braces/parentheses as string delimiters work?

[StackOverflow](
http://stackoverflow.com)

Or triple quotes """like in toml:


# str1 becomes "Roses are red\nVioles are blue"
str1 = """
Roses are red
Violets are blue"""
# str2 becomes "The quick brown fox jumps over the lazy dog." (a single sentence with no line breaks). 
str2 = """\
  The quick brown \
  fox jumps over \
  the lazy dog.\
  """
dmeehan1968 commented 1 year ago

I use Mermaid in Notion, and multiline notes have the last line clipped vertically (seems to be miscalculating the line height).

I can specify the note as separate lines without any special markup, but to solve the clipped last line, I add a line with &nbsp; on its own. eg:

note left of MyState
  This is a multi-line note
  that I don't want to be clipped
  &nbsp;
end note
lemonlion commented 9 months ago

I use Mermaid in Notion, and multiline notes have the last line clipped vertically (seems to be miscalculating the line height).

I can specify the note as separate lines without any special markup, but to solve the clipped last line, I add a line with &nbsp; on its own. eg:

note left of MyState
  This is a multi-line note
  that I don't want to be clipped
  &nbsp;
end note

Doesn't seem to work in the online editor at all:

https://mermaid.live/edit#pako:eNpFj7sOwjAMRX_F8gAL_EBZWRiYYMziJi6NlDilcYQQ4t9xeQjJg3V9LN3zQF8CY4dOKl8bi-d9pMtM2Ql5LTMc7yclZaD6W504kWJR4kGhDP8c4DzGCjYEuSWN2xSFYYGXo46kcIBQZK1wI1HQAj2DT3GaOCzISvo67ZywhPcbbjDznCkG6_hYCIc6cmaHna0pXkZ1Vv5pIDUtp7t47HRuvME2BWv11cFuoFQt5RBN6_ixfss_X0QwWws

rbelem commented 4 months ago

Are there any alternative methods to get multiline notes?

GavinPen commented 1 week ago

I think https://github.com/mermaid-js/mermaid/issues/5460 also covers multiline notes