Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/Multiline sequence message alignment #1315

Merged

Conversation

rmedaer
Copy link
Contributor

@rmedaer rmedaer commented Mar 24, 2020

馃搼 Summary

Please first take a look at PR #1314 , it contains a fix for multiline messages in sequence diagrams.
This PR is an additional improvement which let the user set the alignment of these multiline messages.

It introduces a new configuration option messageAlign which takes 3 possible values:

  • left: align text to the left
  • center (default): text is align in the middle, current alignment
  • right: align text to the right

馃搹 Design Decisions

To left/right align the text, I change the style attribute text-anchor and I move the center alignment line according to the maximum width of text lines.

馃摲 Example

Here is a basic HTTP request/response diagram where text alignment is useful:

example

鈦夛笍 Why two PRs ?

The first PR #1314 is IMHO easier (no additional parameter, no change in flow or logic). This one require a new parameter and a double iteration is mandatory to calculate max text width.

馃搵 Tasks

Make sure you

  • 馃摉 have read the contribution guidelines
  • 馃捇 have added unit/e2e tests (if appropriate)
  • 馃敄 targeted develop branch

This commit allow user to write multiline messages in sequence diagram.
For instance:

```
sequenceDiagram
	Alice->>+John: Hello John<br>How are you?<br>I mean...<br>Are you OK today?
	Alice->>+John: John, can you hear me?
	John-->>-Alice: Hi Alice, I can hear you!<br>Keep calm!<br>I'm there.
	John-->>-Alice: And I feel great!
```
@rmedaer
Copy link
Contributor Author

rmedaer commented Mar 24, 2020

It seems there is an issue with pr-labeler action: see TimonVS/pr-labeler-action/issue/25

Btw, build and tests are still working !

@IOrlandoni IOrlandoni requested a review from knsv March 25, 2020 12:32
Copy link
Collaborator

@knsv knsv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again! Glad to see you added appropriate commentsin the mermaidAPI.js so that it ends up in the docs after regeneration. Keep em coming :)

@knsv
Copy link
Collaborator

knsv commented Mar 25, 2020

The multi line messages looks much better after #1314

@knsv knsv merged commit 9a96f8b into mermaid-js:develop Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants