Skip to content

Matching links and labels#24

Open
Joe-Hankel wants to merge 3 commits intomodality:mainfrom
Joe-Hankel:main
Open

Matching links and labels#24
Joe-Hankel wants to merge 3 commits intomodality:mainfrom
Joe-Hankel:main

Conversation

@Joe-Hankel
Copy link

@Joe-Hankel Joe-Hankel commented Dec 19, 2025

What it is

#23 (comment)

NOTE: I am not particularly proficient in TypeScript. The changes I made work in my JavaScript implementation, and I have made an attempt at converting that over, but there might be syntax errors. Please test this before implementing any changes.

This change reduces the number of calls of computeLinkAndLabel and allows for links which match the labels textually. e.g. the label "New York|New York" produces a label 'New York' that links to the note titled 'New York', where before, no link would be created.

computeLinkAndLabel now returns an additional boolean hasLink. hasLink is now used instead of the test textContent !== linkContent to determine whether the link should be created.

This change also allows the labels on splines to be linked using the same syntax above.

Tests

0000 "City|City"
0000 

0101 
0102 

0000-0102 trail "trail|trail" 40%

Before Screenshot

Before Trail Before

After Screenshot

After Trail After

Baseline Screenshot

Baseline

@maxZ-2020
Copy link

Somewhat unrelated, but for me this raises the question, why the link format in the first place differs from the default Obsidan way of linking using double braces. [[City Link|City Label]].

Maybe that could be another PR?

@Joe-Hankel
Copy link
Author

Joe-Hankel commented Dec 19, 2025

I think it differs because it follows the syntax from the original text mapper by Alex Schroeder. Linking wasn’t possible in that obviously, so this was an adaptation.

That said, I would also love to be able to link the hex numbers or even the icons to other notes, but that’s definitely a different PR. I think if I’m going to work on this more, I’d actually try to get path labels link-able first.

@Joe-Hankel
Copy link
Author

I have added in the spline commit to this pull request, since it seemed close enough in scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants