Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Like Markdown, Mermaid could use a universal way to add some things to nodes. In sequence diagrams there seems to be no way to add classes to nodes. https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/c...


Is this what you're looking for? https://mermaid.js.org/syntax/sequenceDiagram.html

Works fine in VSCode, with the markdown preview mermaid support extension.


That's just a link to the page about sequence diagrams. I know about sequence diagrams - what I don't know how to do is to add a class to a node on there.


Sorry that should have been https://mermaid.js.org/syntax/sequenceDiagram.html#classes-u...

The section where you can add styling by using css classes.


No, that's not what I'm talking about at all. I'm talking about adding a custom css class to a particular node so I can attach behaviors to it with JavaScript.


Ah I see, I guess you're going to be generating the mermaid diagrams? Depending upon how heavyweight you want to go, something like

https://www.npmjs.com/package/vue-mermaid

can work. I've not looked at how it attaches the behavior to the node, there is a way to do it though.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: