MarkdownEditing icon indicating copy to clipboard operation
MarkdownEditing copied to clipboard

Support implicit and shortcut reference links

Open reagle opened this issue 3 years ago • 4 comments

F12 allows me to bounce between the first link and its reference, but not the latter two:

According to <https://pandoc.org/MANUAL.html#reference-links>:

[My first link][first] is explicit, 
my [second link][] is implicit,
my [third link] is a shortcut.

[first]: /bar/baz
[second link]: /baz/bar
[third link]: /foo/bar

reagle avatar Sep 02 '22 14:09 reagle

An aside: once I hit F12, how do I get back to the link? Is the a shortcut to bounce back?

reagle avatar Jan 04 '23 18:01 reagle

Basically bounce should move caret between reference and definition in both directions. I am not too familiar with current implementation though.

My goal would be to make it behave more like normal Goto Definition and Goto Reference somehow and maybe rely on syntax rather than trying to reparse document using regexp patterns.

deathaxe avatar Jan 04 '23 19:01 deathaxe

On the aside: There's no bounce, it's f12 and shift+f12, and I had a keyboard collision from BetterBookmarks messing it up. I sorted that part out.

On the substantive issue, I'm afraid I don't know anything about the implementation (e.g., regex vs syntax AST). Would still love to see implicit and shortcut references though. :)

reagle avatar Jan 04 '23 20:01 reagle

Sure. I need to come up with a plugin, which searches all sorts of links using ST's find_by_scope API. The current solution uses plain regex, which basically duplicates, what syntax definitions have already done.

TBH, I want to finalize some library stuff for Package Control 4.x first as it seems more important to me.

deathaxe avatar Jan 05 '23 17:01 deathaxe