Zettelkasten Forum


Spaces in file paths

Hi @ctietze and others!

So far I had always assumed that The Archive can't handle spaces in file paths, so I either tried to avoid naming my files/folders with spaces or replaced the spaces with %20 in links.
Now I discovered by coincidence that that isn't true (anymore): If the link is enclosed with syntax like <URL> or ![](URL) spaces in the path can don't destroy the link.

Do you still think it's good practice to continue replacing spaces with %20 (which also still works) for the sake of compatibility with other software/operating systems or can I abandon the practice for the sake of simplicity and aesthetics?

Best,
Vinho

Comments

  • edited June 2022

    It depends!

    • <file://...> is a URL, so you should use RFC 3986 URI encoding, which means replacing space (and commas and umlauts etc) with %20.
    • ![](...) loads images and depends on what the Markdown-to-whatever processor can handle, i.e. how liberal it is.
      • POSIX file paths are usually (but not universally) accepted here, so relative file paths work. And spaces in paths can work, too, but not always.
      • Some implementations do treat spaces as a separator between path and image title that would show as a tooltip in HTML and maybe figure caption in PDF output via LaTeX: ![alt title](path/to/image.png "Image title") becomes <img src="path/to/image.png" alt="alt title" title="Image title" />. Play with CommonMark to see how it breaks with spaces, for example.
      • Some only treat the last space as a separator and accept all the spaces before that as path components.

    It's tricky to give a recommendation apart from "try not to use spaces". I use - and _ in my media file names for that reason.

    The Archive strives to be a robust app for the user,

    Be conservative in what you do, be liberal in what you accept from others.
    https://en.wikipedia.org/wiki/Robustness_Principle

    ... so we may accept more than others :)

    Author at Zettelkasten.de • https://christiantietze.de/

  • @ctietze Okay, will continue using %20 then ;) Thanks for your reply!

Sign In or Register to comment.