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
70.75k stars 6.35k forks source link

Note in flowchart diagram #821

Open iCirconflexe opened 5 years ago

iCirconflexe commented 5 years ago

is it possible to add some note in flowchart diagram ? It's possible a with gantt diagram

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

knsv commented 5 years ago

It is not possible right now. What kind of not do you mean? I can see general notes to be placed anywhere and notes related to some node, then that relation needs to be defined.

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you are still interested in it, and it is still relevant, you can comment or remove the label to revive it.

gianpaj commented 4 years ago

I would be great to put a note beside any decision or square.

For example to use a smaller space:

graph TD;

    Buyer -->|press buy| Product
    Product --> Shared{Has Been Shared}
    Shared -->|No| D[Show message saying 'Invite your friends to chat on Onova' Ok or Cancel]
    Shared -->|Yes| ProductAvailable{Product is Available?}

On Shared -> No I want to give more context.

Screen Shot 2019-09-30 at 15 18 01
knsv commented 4 years ago

This could be implemented by creating a hidden subgraph with two nodes, the actual node and the node with the note.

I would suggest synax similar to notes in plan uml state diagrams.

Product --> Shared{Has Been Shared}
note left of Product : this is a short<br />note

note right of Product
  A note can also
  be defined on
  several lines
end note
gianpaj commented 4 years ago

State or Sequence Diagram wouldn't make a lot of sense for me. I have few code paths I'm trying document and, for example, this is just the beginning:

Screen Shot 2019-09-30 at 22 08 57
IOrlandoni commented 4 years ago

@gianpaj Note that the suggestion was to use a similar syntax to PlantUML's state diagrams for the development of the feature. Not for you to use state / sequence instead of flowcharts.

frackham commented 3 years ago

No activity on this for a while (understandably), just wondering if still the case that we'd need to use a workaround? Have used the syntax that @knsv describes in plantuml.

jgreywolf commented 3 years ago

@frackham you are correct, Notes are currently not supported in flowcharts.

JJTell commented 2 years ago

Just wanted to verify that notes still aren't supported in flowcharts? It would be really handy, but I can see there isn't much activity on this thread so I get if it hasn't been looked at.

cyri113 commented 2 years ago

Notes would be great for flowcharts!

abourget commented 2 years ago

Would love the same notation herein: https://mermaid-js.github.io/mermaid/#/sequenceDiagram?id=notes to be available in a flowchart

janzheng commented 2 years ago

This is probably not really a good idea, but (in Notion's Mermaid plugin, at least) you can just use HTML:

flowchart
    A-->B[<div style='text-align: left'><h3>Well well well...</h3><ul><li>this is a really</li><li>round-about way to</li><li>do stuff lol...</li></ul><br></div>];
    B-->C;
zcstarr commented 2 years ago

I'd like to be able to use notes as well

GabrielMMelo commented 2 years ago

+1

zcstarr commented 2 years ago

What would it take to make this enhancement @knsv , happy to take a crack at a PR! If you have pointers on the code path or example to follow that would be great. I saw earlier your suggestion of making a hidden subgraph. Where in the code should I have peak?

numbworks commented 1 year ago

I'm also interested in having notes in flowcharts!

xenoterracide commented 1 year ago

this is not a flowchart specific feature, should be available in all UML diagrams, see #3699 for UML spec.

christian-toscano commented 1 year ago

This feature would be really useful to better explain flow charts

skbolton commented 1 year ago

I think footnote notation could be the play. That way you can annotate with a number or something and have a section at the bottom of the chart hyperlinkable with additional details

MathishaN commented 1 year ago

@skbolton 's idea of footnotes allows for a lot of annotation without clutter. Adding notes like in the sequence diagram doesn't allow room for extended comments.

It would be great if the footnote links could be in markdown syntax that could be included anywhere in the diagram.

alramalho commented 1 year ago

bump

pradeipp commented 1 year ago

+1

skbolton commented 1 year ago

Circling back on this. It seems that some of the note features of class diagrams are what I was suggesting with the footnote approach. I was new to mermaid and had only used flow charts.

If there was the option of adding links to flowcharts it would be possible to link to another place in the document where footnotes could be located.

JohnRusk commented 1 year ago

This feature would be super useful. E.g. right now I'm looking at a complex flowchart. I want to leave notes on it, about questions I want to ask a colleague in a few days.

I really think folks would find this feature very useful.

stevancorre commented 1 year ago

yup, would be a really useful feature to make graphs more understandable instead of having graph + legend with few words

1337spectra commented 1 year ago

I'm adding my +1.

mradilla commented 1 year ago

+1 🙏

hatvik commented 1 year ago

This would be very useful +1

piperdeck commented 1 year ago

Adding my +1 here as well

Angelles commented 1 year ago

I would also love notes in flowcharts.

caleb-terry commented 1 year ago

I've travelled through time and space to land here for this feature

eugenenekh commented 10 months ago

This is what I've come up with so far as a workaround:

graph TD
    style noteB opacity:0

    A --> B
    A & B --> C

    subgraph noteB [" "]
        B -.- note[I AM NOTE]
    end
graph TD
    style noteB opacity:0

    A --> B
    A & B --> C

    subgraph noteB [" "]
        B -.- note[I AM NOTE]
    end
jgreywolf commented 9 months ago

I am working on this right now

jgreywolf commented 9 months ago

FYI - in practice this is probably going to end up looking a lot like the workaround posted by @eugenenekh, though the syntax will be along the lines of "note for nodename this is a note"

jsteinfort commented 9 months ago

FYI - in practice this is probably going to end up looking a lot like the workaround posted by @eugenenekh, though the syntax will be along the lines of "note for nodename this is a note"

You know... after this many years, I think we get what we get. :-) Thank you for your work.

joewinger commented 7 months ago

Any movement on this? Sorry to beg!

erivanmoura commented 7 months ago

Following your idea I created another alternative

graph TD
    classDef sub opacity:0
    classDef note fill:#ffd, stroke:#ccb

    A --> B
    A & B --> C

    subgraph subA [" "]
        A
        noteA[I AM THE FIRST NOTE]
    end

    subgraph subB [" "]
        B
        noteB[I AM THE SECOND NOTE]
    end

    subgraph subC [" "]
        C
        noteC[I AM THE THIRD NOTE<br>...WITH 2 LINES]
    end

    class subA,subB,subC sub
    class noteA,noteB,noteC note
graph TD
    classDef sub opacity:0
    classDef note fill:#ffd, stroke:#ccb

    A --> B
    A & B --> C

    subgraph subA [" "]
        A
        noteA[I AM THE FIRST NOTE]
    end

    subgraph subB [" "]
        B
        noteB[I AM THE SECOND NOTE]
    end

    subgraph subC [" "]
        C
        noteC[I AM THE THIRD NOTE<br>...WITH 2 LINES]
    end

    class subA,subB,subC sub
    class noteA,noteB,noteC note
zlatko-minev commented 7 months ago

Great answer @erivanmoura

CJyoung524 commented 5 months ago

mark it! it's cool

nirname commented 2 months ago

Any updates? I know there is a plan on universal syntax for a bunch of similar diagrams, should we wait for it or will this feature be implemented regardless of other plans?

danielthedifficult commented 2 months ago

Came here looking for this feature! Yes please!

luisarojas commented 1 month ago

Hey, was wondering if there's been any movement on this one? Notes with flowcharts would be so handy

Youllou commented 1 month ago

Would love to see this implemented ! As a workarround I use subgraphs and put my comment in the subgraph name image It's not ideal but it kinda works while waiting for the actual note feature