BBazard / obsidian-orgmode-cm6

Orgmode plugin for Obsidian
MIT License
44 stars 1 forks source link

respect ID: link format in .org files #6

Closed robby4769 closed 2 months ago

robby4769 commented 3 months ago

Hi there, thanks for making such a great plugin!

As discussed on the obsidian forum, I'd love to see this plugin format and obey the "ID:" link format in org-mode.

discussion in orgmode manual here

and two screenshots (link display toggled on and off in emacs)

image image
BBazard commented 3 months ago

It is a great feature I agree.

Linking to an ID inside the file in one thing, but linking to an ID in another file is more complicated. It implies to parse all the files in the vault, the plugin currently only parse one file at a time.

My understanding is that emacs can only resolve ID links if you have the buffer of the target file open. Is that how you use it?

robby4769 commented 3 months ago

No emacs (orgmode) will resolve an ID link anywhere in org-directory (and subdirectories if configured appropriately), whether or not it’s in a file that’s currently in a buffer.

I believe org-roam further enhances this by keeping a table of links and backlinks in a sqlite database, and updating the table every time a new link is created.

I agree; I don’t see any way to do it without some kind of either pre-processing or on-demand search. I imagine that’s how obsidian’s linking to nodes works as well?

in the short run, at least formatting the links, even if resolving doesn’t work, would be valuable. Especially with the auto org-generated uuid link style, my notes are pretty unreadable. IMG_6564

BBazard commented 3 months ago

Implemented in 2.3.0

I went with an on-demand search. When clicking on an :ID: link, the plugin will open all the .org files of the vault, parse them and look for a matching id. It works fine for a few files but it's possible it might take a long time with a large vault of org files, I didn't test it. Obsidian has a caching mechanism to not have to read the files from disk every time so that's already a good optimization.

robby4769 commented 3 months ago

This works great, thanks!