How to both store and render raw path in functional link

Issues with rendering windows paths, clarification of syntax


I have link in format [\\10.0.0.150\path with\spaces and diacritics áč.txt](file:///%5C%5C10.0.0.150%5Cpath%20with%5Cspaces%20and%20diacritics%20%C3%A1%C4%8D.txt)

  • Link text is original path copied from Windows Explorer, to be presented as is.
  • Link target is adapted to make the link functional in Obsidian.
  • First backslash does not propagate to preview mode. Is that intentional?
    If not, then please fix it. If yes, then why, and what is efficient way to formulate link which shows original path unchanged in rendered mode (for purpose of manual copy) and in original source file (for purpose of text search by third party application).

backslashes are consumed before underscores in link destination whether or not enclosed in angle brackets <>

  • example: [link1](<file:///C:\Users\Jan\Desktop\_playground\čert a káča>) or [link2](file:///C:\Users\Jan\Desktop\_playground\čert%20a%20káča)
    attempts to open C:\Users\Jan\Desktop_playground\čert a káča
    instead of C:\Users\Jan\Desktop\_playground\čert a káča
  • Version with angle brackets works also without percent encoding of spaces so if this issue is fixed, then it could accept links in original form without any encoding/escaping treatment. Convenient for manual copying paths from Windows Explorer and for searching/indexing by simple tools (and easier to read).
  • I do not know if markdown requires to escape underscores in link target which is never going to be italicized/bold.
  • funny thing is backslash disappears even before encoded underscore, i.e. [link2](file:///C:\Users\Jan\Desktop\%5Fplayground\čert%20a%20káča)
    attempts to open C:\Users\Jan\Desktop_playground\čert a káča which I do not get.

other issues: (tested on windows 7)

  • ["works"](file://///10.0.0.150/my/path/00_SEZNAMY_aktualni)
  • ["does not work"](file://///10.0.0.150/my/path/00_SEZNAMY_aktualni/archivn%C3%AD%20a%20pracovn%C3%AD) - It seems that combination of percent-encoded diacritics together with backslashes changed to slashes is not feasible combination and backslashes need to be encoded to %5Cwhich makes it look awful in source code.
  • <a href="file://///10.0.0.150/my/path/">This does not work in Obsidian even when no diacritics is present. But when pasted to html file, and open in Google Chrome, then opens folder within Chrome, even when diacritics is present and even when prefix "file:///" is removed.</a></br>

Related bug: Code enclosed in backticks "``" does not preserve double/consecutive spaces

Backslash is an escape charachacter. You need to escape it to use it: \\ = \

I don’t think there is any bug here. Just some markdown quirks and you trying to express paths. Open a thread in the help section.

@WhiteNoise I posted This topic originally in Help section (as can be seen in history of changes) in hope to get answer to question in the title
How to both store and render raw path in functional link
@ryanjamurphy decided to move it to bugs before receiving help/advice, likely due to the way I have formulated body of initial post. I do not know how to move it back to original help section.

Conclusion:
So far, it seems impossible to satisfy reliably all three features - raw storage, rendering and clickable link.
Either we need to give up raw storage and searching by inserting backslashes.

Or give up rendering by storing raw path in link-text without additional backslashes. Because even text enclosed in backticks or html “pre” tag does not preserve characters.

Or store raw path in place of link-target, getting broken link due to not being encoded.

One solution would be to store raw path in metadata of the link. (Mentioned in Allow internal links to any element via anchor
I will post request for it soon. )