Mermaid links to honour headers/URL fragments

Currently, links within mermaid graph markdown are not as capable as those within regular markdown, specifically they cannot link to headings in notes in the same vault.

For example [[Long Document#Section2]] links to Section2 of Long Document however the equivalent in mermaid will link only to the top of Long Document.

graph LR
node_a --> node_b;
click node_a "/Long Document#Section2";
class node_a internal-link;
1 Like

In case anyone else stumbles across this asking the same question, I followed this Forum Post and got mermaid linking.

Simply define a class (after the graph) as an internal-link and then what you place in the class brackets (Also the displayed text) is the destination mermaid will link e.g.

graph TD;
	Test("Document#heading")-->Point;
class Test internal-link;

Graph working representation