How to Link a file with filename with spaces

I am have a little difficulty with adding internal link to a file with filename having ‘space’. For example, when the filename does not have ‘space’ in its name, it can easily be written as [[Test1]] and I can write a link as, this file, as shown in the image. It works flawlessly. But when there is ‘space’ in file name as [[Test 2]], then writing it as [this file](Test 2) does not work. I have attached example images.

Am I missing something here? or is there any other way I should be doing it? I really can’t skip ‘spaces’ in all my file names.

1 Like
  1. You can add the links in the following way
    [[Test 2|this one]]
  2. And in the way you are linking it can be done as [this one](Test%202)
2 Likes

Or, if using the Markdown style links (which you seem to do), you can keep links with special characters a little more legible by using <…> around them:

[this one](<Test 2>)

This notation will ensure that the link is properly URI-encoded.

3 Likes

Thank You. @Walrux @moonbase59

Out of all three possible ways, that is,

  1. [[Test 2|this one]]
  2. [this one] (Test%202)
  3. [this one] (<Test 2>)

First one I seems to like, second one is tiresome cause when mentioning headings etc there are number of ‘spaces’ involved and adding % at every gap will require lots of work. I also like the last one. But before making final choice between 1 and 3, I want to know which option is widely used, and which linking option is supported with other markdowns.

  1. Is Obsidian “wikilink” style, superfast, supported by the suggester, and links to “Test 2”, providing a link text of “this one”.

    This is—unfortunately—not very compatible with other Markdown tools and editors, since a database over the whole vault would have to be built (per external tool or editor) to fully support this link style. Obsidian—rather elegantly—does this for us; but only as long as we work within Obsidian.

  2. (without a blank between the […] and the (…) parts!) is standard Markdown.

  3. Is clearly defined in the CommonMark spec (which Obsidian uses), and less clear in Gruber’s original Markdown spec, but nevertheless widely supported. It is also an easy way of avoiding the cumbersome manual URI encoding.

N.B.: Using the Markdown styles (2) or (3), a link text can be had by adding it in single ' or double " apostrophes after the link:

[this one](<Test 2> "my link text")

In this case, the generated HTML should look like:

<p><a href="Test%202" title="my link text">this one</a></p>

(to show what goes where)

3 Likes

@Moonbase59 Thank for the thorough answer.

I think, between compatibility and convince, I will go with compatibility (that is the third option).

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.