nobiot/md-roam

File Names or Titles with spaces break md-roam

dschapman opened this issue · 6 comments

I was having trouble getting my the org-roam.db file to build correctly in my folder full of only markdown files. I would run org-roam-db-build-cache but whenever I used org-roam-find-file no files would show up. Eventually I tried renaming all my markdown files so that they no longer had spaces in the file, replacing it with -. After doing that I was able to run org-roam-db-build-cache correctly; however I noticed that the org-roam backlinks didn't show up for notes that had titles in them.

For example: I have a note whose title is website. The backlinks show up fine when I have that file open. I also have a note whose title is website redesign. These notes both link each other but the backlinks only show up in the note with a title and not in the note with a space in the title. This seems to be true across all of my markdown notes. The ones with spaces don't have backlinks, the ones without spaces display their backlinks.

Hmm.

I don't seem to be able to reproduce the problem.
See the screen shot below. I'm on Windows 10. Not sure if the OS influences this, but what is your OS?

I have not seen any issue or pull request for Org-roam on this, but would you like to try updating Org-roam?

Does this example cover your cases you reported? Anything missed?

  • file name: "testmd with space.md"
  • title: "markdown file with space in the file name"
  • Backlink from an existing note works.
  • org-roam-insert shows the test file name with spaces
    image

I updated org-roam and still see the same behavior. I'm also on MacOS.

To clarify, once I changed my filenames to no longer have spaces I was able to build the org-roam.db and use org-roam-insert without issue, maybe that was a separate issue unrelated to the other problem I have where files with spaces in the title don't have any backlinks. Although your example covers my cases and has backlinks so maybe there's something else happening.

I'll include two screenshots to show what I mean:

Screen Shot 2020-07-07 at 7 59 49 AM

My website note has backlinks and works as expected. However the digital garden note below which is linked in website does not display website as a backlink.

Screen Shot 2020-07-07 at 8 00 04 AM

Your UI looks impressive. I’m also very happy to see Md-roam in action in a really beautiful way like you do. Thank you.

Now... I’ll take a guess here....

Your expectation is that [[wiki link]] is a link via title of your note. Is this correct? That is, you expect [[digital garden]] to point to the file named digital-garden.md (that is entitled “digital garden” in the front matter). Let me know if I am mistaken...

If so, I am afraid that I might disappoint you. The way wiki link works at the moment is that it uses the filename to link to another note. The syntax is [[filename without the extension]]. With your example, it needs to be [[digital-garden]] because the filename is digital-garden.md. So.... if you had a filename digital garden.md, it should work with [[digital garden]] — if not, and if this had been what you have been trying to communicate to me, I will need to look further.

On a separate, but related note, there is a pending pull request on Org-roam that adds a related feature. I wanted to see how this might be incorporated.

I’m also looking to improve the wiki link syntax to be a bit more fluid in the note’s body of text like you are doing. This PR might be a very advanced starting point for that effort.

Thanks for that compliment! I'm using the doom-tomorrow-day with the Adobe Garamond font and mixed-pitch-mode!

You're right I was misunderstanding what the [[wiki link]] was using to create links. That also explains why it wasn't finding aliases when I used them.

Hopefully that pending pull request opens up new possibilities, but for now I'll consider this closed.

Thanks!

@dschapman, in the meantime, I’m considering two additional features, based on this issue and looking at how you currently creates your website:

  1. Support the standard Markdown link syntax — `description, or title if any for backlinks

  2. Add a function to swap [[filename without extension]] and the Markdown syntax

I cannot really promise that I have enough skill to do both, but I’ll give it a shot. I won’t be able to do much this week or weekend, but looking to do something after that (and hopefully ship something within July...).

If I’m successful, then, I think it will let you use [[filename without .md]] to write your note, and then swap it to (title)[./filename.md] for publishing for Gatsby... Or add to the logic of md-roam-insert to allow an option to directly insert the Markdown link... Something like this.

Do you think that will be useful? Any thoughts?

I think that adding to the md-roam-insert logic and supporting standard markdown links sounds most appealing from a workflow perspective. Obviously no rush to implement but that sounds cool to play around with.