Mermaid example diagrams#3090
Conversation
|
Hi. Thanks for the PR! Having the state diagram in a text-like format would indeed be nice. Can you explain how one would generate pictures with mermaid and/or how one could embedd those diagrams into the respective examples pages (e.g. here)? |
|
Hi @Bibo-Joshi, I've used Mermaid since it is supported and rendered in Github in the Markdown view. To include it is as easy as having a code block like
|
|
The sphinx plugin should be enough, no need to self host an API. |
harshil21
left a comment
There was a problem hiding this comment.
Looks great, thanks for the PR.
Can you explain how one would generate pictures
I can see that we can download it as svg/png at https://mermaid.live
The sphinx plugin should be enough
Agreed. Other options would be to use svg/png, but that would mean updating those files too after changing the mermaid code -- double work.
Can you also apply similar changes by integrating the sphinxcontrib-mermaid sphinx extension?
You'll have to add it to the conf.py and requirements-docs.txt. I guess we can just use these files as the reference by doing: .. mermaid:: examples/conversationbot.md in the docs/examples.conversationbot.rst file, and then build the docs locally by following our contribution guide.
|
If we can integrate the diagrams into sphinx directly, then we should do that and ditch images completely, I agree. Just for completeness: I see that sphinx has built-in support for graphivz, i.e. we wouldn't need a plugin. I'm fine with using a plugin, though. |
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
|
I've installed the sphinx mermaid extension and embedded it successfully in the docs. However, there are a few things to be aware of:
|
|
Hi, thanks for the updates! Personally I don't see a problem with darkmode - IMO the lines are rather well visible. I'm attaching screenshots below so that the others can see without having to build the docs :) Having the nestedconversationbot chart a bit wider would be nice, I agree. Don't recall exactly how one would modify the css here. If it's a small additional snippet for the sphinx config, we can do that. if it's a bigger effort, I'm also okay with user having to zoom in :D I have some other comments on the layout:
|
|
I've included most of the things that you've mentioned plus did some additional improvements. Like you've already guessed, some things are automatically created by Mermaid and I sadly cannot change e.g. the alginment of the nested conversation. A few things to note:
|
|
Thanks for the new updates! I built the docs from your branch locally and everything looks fine to me now :) If I get a LGTM from pool or harshil, we can merge :) |
|
can we remove the old |
|
@harshil21 yes 👍 |
|
Thank you for the nice cnotribution! :) |


Add Mermaid diagrams for better visualization of the examples and to make use of version control. It will be also easier to edit the diagram if the examples change.