Mermaid Links with Use of Aliases or Custom Link Previews

Use case or problem

When creating Mermaid diagrams with internal links that have long names that I do not want to shorten in the vault, it would be nice to make use of these long links in the diagrams but have them display as shorter versions.

Proposed solution

If aliases and/or Custom Link Previews worked in the diagram, this would not be an issue.

Current workaround (optional)

In order to keep the longer note names in the vault but allow for having the shorter working note name internal links in Mermaid diagrams, I simply change the note name to the shorter version and set aliases for the longer version that I want to display in my vault. It is not ideal when retrofitting but it works pretty well. I can use the alias pipe link version with a mass search and replace so that all the long links that get shortened can be switched to the longer alias version.

Thanks.

6 Likes

I am looking forward to this feature too. I currently use zettel naming conventions in my vault, and the mermaid flowchart makes no sense if I can’t use alias to link notes in them.

1 Like

In addition, it is also gonna be extremely useful if we can link the text on mermaid links to notes in the vault too.

1 Like

Great idea.

That may even warrant a separate feature request if you are up for making it.

Thanks.

I figured out how to do this using the Obsidian URL for the note.

Here is an example from my notes

flowchart LR;  

content[Content]
fleet[Fleeting Note]
lit[Literature Note]
perm1[Permanent Note]
perm2[Permanent Note]
perm3[Permanent Note]
perm4[Permanent Note]

content-->|Take notes|lit;
fleet-->|processed ideas|perm1;
lit-->|processed ideas|perm1;
perm1-->|Link to|perm2;
perm1-->|Link to|perm3;
perm1-->|Link to|perm4;

 
click fleet "obsidian://open?vault=Smart%20Notes%20Presentation&file=Fleeting%20Notes%20are%20brief%20reminders%20of%20your%20thinking" _blank
click lit "obsidian://open?vault=Smart%20Notes%20Presentation&file=Literature%20Notes%20help%20capture%20ideas%20and%20concepts%20while%20consuming%20content" _blank
click perm1 "obsidian://open?vault=Smart%20Notes%20Presentation&file=A%20Permanent%20note%20contains%20a%20single%20idea%20that%20is%20the%20result%20of%20your%20thinking%20on%20what%20you%20have%20learned" _blank
click perm2 "obsidian://open?vault=Smart%20Notes%20Presentation&file=A%20Permanent%20note%20contains%20a%20single%20idea%20that%20is%20the%20result%20of%20your%20thinking%20on%20what%20you%20have%20learned" _blank
click perm3 "obsidian://open?vault=Smart%20Notes%20Presentation&file=A%20Permanent%20note%20contains%20a%20single%20idea%20that%20is%20the%20result%20of%20your%20thinking%20on%20what%20you%20have%20learned" _blank

I figured this out by looking at the Interaction section of the Mermaid Documentation.

2 Likes