Hi! I was playing around with KSP and Mermaid, thi...
# dokka
g
Hi! I was playing around with KSP and Mermaid, thinking that I could generate the relationship graphs of classes (mainly public classes/fields that are visible in the API, ignoring technical details). Is there an existing tool doing the same kind of stuff that could be integrated with Dokka ? If not, knowing that Mermaid can handle clicks, maybe we could have a more visual way to navigate documentation ?
👀 2
👌 5
👍 1
a
It's not integrated with Dokka, but IntelliJ can generate class diagrams like that: https://www.jetbrains.com/help/idea/class-diagram.html
g
Oh thanks, I didn't know about that tool. Looks like it's only for ultimate (and sadly I've only the community edition). Are you using it and is happy with it? Do you produces some diagram that are used for a html documentation?
What I'd love is something that is automatically generated from code (low maintenance), with a doc accessible from IDE and outside IDE (for our external clients, so probably html). And something better again could be a sequence diagram of our integration test "traces" (like all calls that have been done), so that a GWT business is illustrated by a clear list of calls. And if I can navigate from class diagram to sequence diagram to code/public documentation, then it's awesome. Not sure how to achieve the traces (especially in a KMP project) but I'll definitely try something. Please don't hesitate to share your ideas/inputs.
l
Hi @Grégory Lureau I really like your idea. Do you mind sharing the code you used to generate the diagram?
g
Sure, here it is https://github.com/glureau/MermaidKsp Parsing to my "domain classes" looks ok so far (only dealing with classes), I've made the rendering a bit configurable. I plan to generate a diagram by package and maybe even by classes, so that it can be included in the Dokka documentation (with this one). What do you want to achieve?
l
Thanks a lot! I was always intrigued by KSP and never got a chance to look at it. This use case looks very promising for automatically generating nice class diagrams, especially now that github supports mermaid this would be super useful. Having this in dokka similar to what you described would be even better though.
❤️ 2
g
The code could be adapted with a gradle plugin to generate a graph/markdown from a specific annotation on the class, so that it's generating on demand. I'm just a bit sad that we cannot include a markdown in another markdown (at least not in IntelliJ, and I think not in github). But having a file automatically generated and overriding at each generation in the src/ (to be committed easily) could still be good enough for most use cases I presume.
👍 1
Now generating markdowns for packages and modules. A couple of gradle lines and it's auto-imported in Dokka. 🎉
🔥 3
i
Looks really cool :) Good job
h
nice, did you publish the docs online?
g
Not yet, I still have some finetuning to do (internal classes are visible in the 2nd screenshots but are not displayed by Dokka for example). Also the project I'm working on is closed-source so I won't be able to share it. But if you know an open-source project that could benefits from that, it could be a good showcase of the tools.
l
Amazing! Any updates on this?
138 Views