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
68.8k stars 6.09k forks source link

Sequence Diagram Title Isn't Centered #3927

Open apeacock1991 opened 1 year ago

apeacock1991 commented 1 year ago

Description

When adding a title to a sequence diagram, it is not centered, unlike all other diagrams. It doesn't matter whether you use the new title syntax, or the old one.

Steps to reproduce

Sequence diagram example with text not centered:

---
title: Not center
---
sequenceDiagram
    A-->B: test

Class diagram centered:

---
title: Not center
---
classDiagram
    A-->B

Screenshots

Screenshot 2022-12-18 at 19 12 40

Code Sample

No response

Setup

Desktop

Additional Context

No response

apeacock1991 commented 1 year ago

Mermaid usage sucks on GitHub. Unlike every other language, a code block is executed rather than displayed. A prefix on the first line like ! should have been used for execute.

You can just leave off the "mermaid" from the first line, and just do it with backticks:

Not rendered:

sequenceDiagram
  A->>B: test

Rendered:

sequenceDiagram
  A->>B: test

Sure it doesn't give you syntax highlighting, but Mermaid's syntax is very simple anyway, so I think it's generally fine

zsynacl commented 1 year ago

Encounterd same issue when using Typora, and I'm pretty sure that issue will happen on Github.

sequenceDiagram
title: 备选方案1:很长的描述文字ABCDEFGHIJKLMNOPQRST

A ->> B: msg1
B -->> A: msg2
A ->> A: do something
A -->> B: msg3<br/>(status=true)
B -->> C: msg4