dendronhq / dendron

The personal knowledge management (PKM) tool that grows as you do!
https://wiki.dendron.so
Apache License 2.0
6.72k stars 255 forks source link

Mermaid interaction - Link to local files/notes #2220

Open Trerot opened 2 years ago

Trerot commented 2 years ago

Please select if your request is either something new or an enhancement

Please select the area your request applies to. (Multiple selections are Possible. You can leave blank if you're not sure.)

Is your feature request related to a problem? Please describe

mermaid supports interaction via clicks. and it works fine for https links like in the example below.

graph TD;
    A-->B;
    click A href "https://bbc.com"

but does not work with local files or notes. "file://localhost/c$/Users/Trerot/test.txt" or [[dendron.topic.markdown]]

https://mermaid-js.github.io/mermaid/#/flowchart?id=interaction

Describe the solution you'd like

ability to link to local notes in mermaid diagrams kinda like in the example below.

graph TD;
    A-->B;
    click A href "[[dendron.topic.markdown]]"

Describe alternatives you've considered

Additional context

hikchoi commented 2 years ago

Thank you for the suggestion. 🙏🏼

This indeed sounds like a useful feature. However, from a quick glance of the mermaid docs, it looks like we need a way to provide a javascript callback to mermaid. I believe this is somewhat tricky to do within a vscode webview.

I am not sure if mermaidjs is extensible (as in we can implement plugins that work with mermaid to do this), but if so, that could also be another route we could take.

I can definitely see this being very useful for some cases. I can't give you an ETA on this but is something we can discuss moving forward.

HenrikSAndresen commented 2 years ago

I would appreciate this feature as well for easier to read documents

Ideally it could be as simple as writing

graph LR;
A --> B
click A "[here](doc_two.md)"
KenSykes commented 2 years ago

Just started using Mermaid embedded inside markdown files, love it! Would very much like to create interactive diagrams that navigate to portions of our source code. Consider this a +1 for fixing this issue :)

letmp commented 1 month ago

Any news for this issue? It would be really helpful for the documentation of larger software projects!