Use case or problem
Link to a particular part of a target page while either:
- Not having nearby header
- Not having to put the same name as the header into the link
The general use case is just being able to navigate around documents without messing up the outline view with headings everywhere.
I also have a specific situation where I web clip sites and rewrite absolute URLs into wikilinks, but the anchor tags are ignored inside documents so internal links are all semi-broken. Sometimes hundreds of them.
Proposed solution
Support XHTML self-closing anchor tags using the name or id attributes.
[to foo](#foo)
[[#foo|to foo]]
<a name="foo" />
It was the best of foo it was the worst of foo.
I specify self-closing tags, because Obsidian currently highlights the contents of any a
tag, even if it doesn’t have an href
and is not a link. This seems like it might have less of an impact.
Alternatively (or in addition), support heading IDs and linking to them.
[to foo](#foo)
[[#foo|to foo]]
# This is my Foo {#foo}
It was the best of foo it was the worst of foo.
Current workaround
I m considering writing a script that extracts anchor tags from files and matches them to the nearest heading to rewrite all the links to anchors. This is extremely suboptimal.
Another DIY development option would be writing a plugin which detects that you clicked on a link where the heading was missing and then looks for similar headings or text matches.