-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Thanks for your great work on this plugin! This feature would make Graph Link Types even more expressive and user-friendly in a graph knowledge workflow.
I’d like to request support for parsing edge types directly from the alias portion of Obsidian wiki links using a & delimiter syntax.
This allows users to semantically describe relationships inline, without requiring frontmatter or dataview fields.
✅ Supported Formats
| Syntax | Display Text | Relation Type | Note File Target |
|---|---|---|---|
[[Plato|Socrates&teacher_of]] |
Socrates | teacher_of |
Plato |
[[Plato|&teacher_of]] |
Plato | teacher_of |
Plato |
[[Plato|Socrates]] |
Socrates | (none) | Plato |
[[Plato]] |
Plato | (none) | Plato |
[[Plato&teacher_of]] should not be parsed this way because & is valid in note titles.
Reference Implementation (Experimental)
I’ve extended the getMetadataKeyForLink() function to support this logic. Here’s the relevant snippet:
private getMetadataKeyForLink(sourceId: string, targetId: string): string | null {
...
for (const l of sourcePage.file?.outlinks ?? []) {
if (l.path !== targetId) continue;
const disp = (l.display ?? "").trim();
if (!disp) return null;
const ampPos = disp.indexOf("&");
if (ampPos === -1) return null;
const aliasPart = disp.substring(0, ampPos).trim();
const propPart = disp.substring(ampPos + 1).trim();
if (!aliasPart || !propPart) return null;
return propPart;
}
return null;}
This checks for outlinks with a display string of the form Alias&Relation, splits them, and uses the right-hand portion (Relation) as the edge label.
Additionally, I would like to have a function (or CSS snippet) that hides after the & delimiter in a link’s display text, so that only the part before & is visible in the rendered note. This would ensure a clean and intuitive display while preserving the semantic edge information for the graph.
Thanks!