Use case or problem
I can open a Markdown link like this to an HTML file from a note in Obsidian:
[FAQ](file:///C:/Program%20Files/ffmpeg/doc/faq.html)
That’s great to point to external large files for documentation, references and more. Unfortunately, I cannot open the same file if the link contains a fragment identifier (i.e., “#something”):
[FAQ](file:///C:/Program%20Files/ffmpeg/doc/faq.html#How-do-I-encode-single-pictures-into-movies_003f)
When I try to open the link with a fragment identifier, there is a message saying “Windows cannot find <full-link-as-a-file-including-the-fragment>. Make sure you typed the name correctly, and then try again.”
I actually believe this behavior to be a bug. It seems this bug was already buried before (again and again, including links to PDF files), so I’m suggesting its fixing to be a feature!
Proposed solution
Use a proper URI parser to separate:
- base path (up to the first
#) - fragment(s) (everything after the first
#)
E.g.:
file:///C:/Program%20Files/ffmpeg/doc/faq.html#section1#subsection
should yield:
base = file:///C:/Program%20Files/ffmpeg/doc/faq.html
fragment = #section1#subsection
If the file extension is .html, .htm, .xhtml, .shtml, or .pdf, then open the full URL (including the fragment) in the system browser or PDF viewer using shell.openExternal. Otherwise, use shell.openPath.
Current workaround (optional)
Unfortunately, there is no workaround I’ve found. Many links I had in notes imported from Evernote simply do not work in Obsidian.
Related feature requests (optional)
I found at least three other similar bug reports feature requests:
