mermaid icon indicating copy to clipboard operation
mermaid copied to clipboard

Using Sequence Diagram is there any way to make some parts of the text in bold?

Open bundgaard opened this issue 4 years ago • 21 comments

First of all, thank you for an amazing product.

I was trying to convert some diagrams from sequencediagram.org to the flavor that is used inside mermaid. I wanted to be able to emphasize/bold some text, either using Markdown or pure HTML, but it seems not to work.

note right of A: <b>BOLD ME</b> <em>EMPHASIZE</em> but not respected as a command.

Help us help you!

You want an answer. Here are some ways to get it quicker:

  • Use a clear and concise title.
  • Try to pose a clear and concise question.
  • Include as much, or as little, code as necessary.
  • Don't be shy to give us some screenshots, if it helps!

bundgaard avatar Jan 04 '21 08:01 bundgaard

Currently, I don't think there is a way to do this; messages in sequence diagrams are plain text (with the exception of some keywords), not HTML.

You could mark this as a feature request, or fork the project. Here's a place to start: https://github.com/mermaid-js/mermaid/blob/e08ae8ed4a7ddc1ae2dd851608ffe4d831adac97/src/diagrams/sequence/svgDraw.js#L21

GiovanH avatar Jan 06 '21 06:01 GiovanH

I am 'old' to Mermaid and I am surprised to see that after changing to Mermaid 8.12 things like Bold using <b>The Bold Text </b> (My Text in Bold) and Italics using <i>The Italic Text </i> (My Text in Italics) have stopped working, which was working in Version 7.03 as I am now having to stick using it. Which is a shame What was the reason of the decision to drop the usage of one of the most basic of "HTML 1.x" tags?? Nice to have the possibility to do a feature request, but what is the point if one looses that basic feature in the next version I am asking myself. Forced to stick with the 'old' now.

pierreverbakel avatar Sep 02 '21 11:09 pierreverbakel

I am 'new' to Mermaid and came across this while looking to do the same thing. It's disheartening to know that it used to work but doesn't now.

alexfornuto avatar Sep 07 '21 16:09 alexfornuto

I'm not surprised that HTML tags don't work, but am surprised that markdown inside graph labels doesn't work.

MichaelTiemannOSC avatar Feb 28 '22 09:02 MichaelTiemannOSC

any answer on this ?

LuisBL avatar Dec 03 '22 09:12 LuisBL

ping

ggriffinn avatar Jan 23 '23 16:01 ggriffinn

pong

avdata99 avatar Jan 29 '23 19:01 avdata99

This is very unfortunate

DonSmilo avatar Jan 29 '23 20:01 DonSmilo

just adding mine to the voices

vzakharov avatar Feb 10 '23 08:02 vzakharov

Same here

morscher-m avatar Mar 01 '23 18:03 morscher-m

It would be very useful to have mono-formatted text (i.e. back-ticked markdown like this) working throughout mermaid, especially since it's commonly used to document code-related subjects.

(rendering via v9.4.0)

DavidAntliff avatar Mar 13 '23 01:03 DavidAntliff

Same here. Also would be interested in having the possibility to declare code text within messages as @DavidAntliff suggested.

klausk-vipaso avatar Mar 13 '23 15:03 klausk-vipaso

hi @jgreywolf, any chance this can get promoted to Type: Enhancement?

pseidemann avatar Mar 22 '23 23:03 pseidemann

yes please promote

LuisBL avatar Mar 23 '23 14:03 LuisBL

Done. Will also research a bit why support ended

jgreywolf avatar Mar 24 '23 14:03 jgreywolf

I've recently found success through enabling htmlLabels, something like %%{ init: {'theme': 'dark', "graph": {"htmlLabels": true}} }%%

luftlight avatar Apr 07 '23 04:04 luftlight

Interestingly <b> tags appear to work for flowcharts, at least within nodes with text. Or using markdown strings

jxu avatar May 01 '23 19:05 jxu

I would also like this feature

ckhiu avatar Apr 09 '24 11:04 ckhiu

I've recently found success through enabling htmlLabels, something like %%{ init: {'theme': 'dark', "graph": {"htmlLabels": true}} }%%

is this still working for you? Does not work for me with <b> tags in notes...

ckhiu avatar Apr 16 '24 07:04 ckhiu

I'd like to just add on here that if Mermaid is going to support html in sequence diagrams (or other places), it would be extraordinarily useful to be able to wrap a block of text in a <div/> and set the width with styles, rather than having to litter my text with manual <br/> tags. Keeping the line-breaks up to date while your text is changing is definitely a pain point.

IainDavis avatar Apr 18 '24 00:04 IainDavis

It worked for me while creating bold and italics text within Mermaid diagrams in Notion. Hope this helps

flowchart LR
A-->I(<i>in silico</i> hypothesis generation)

mohitpandey92 avatar Jul 03 '24 16:07 mohitpandey92

The simple wish is to have the possibility to

  • have the messages that are sent between participants not only plain text, but
  • contain at least some markdown markup possibilities, like e.g., in nodes of flowcharts.

This idea seems to be around for a while, e.g. here https://github.com/mermaid-js/mermaid/pull/4725/commits/6ffe9c872f617787716be72111bc655e1cd3559c

heindel avatar Jul 25 '24 10:07 heindel

This would be helpful in sequence diagram.

mantriyogesh avatar Aug 08 '24 04:08 mantriyogesh