Using Hookmark with Obsidian

This document assumes you are using Hookmark 3.5 or newer, and Obsidian O.14.16 or newer. If you are still using Hookmark 3.4.3, please refer to Using Hook 3.4.3 with Obsidian.

Obsidian is an Electron-based note-taking app that treats links as first class data objects. It is “a powerful knowledge base that works on top of a local folder of plain text Markdown files.”

With Hookmark, you can easily link your Obsidian notes to just about anything. Not just to other Obsidian notes, but to emails, web pages, and more. Plus, Hookmark provides a native Mac user interface experience to linking Obsidian information. With Hookmark, you can use the same familiar interactions across all your favorite apps, including Obsidian.

Hookmark enables you to choose one of three different URL schemes for Obsidian (default, “advanced” URI, or hook file). The default option is available ‘out of the box’, whereas the other two require a bit more configuration. There are tradeoffs between each approach. In addition, of course, Pro users can customize Hookmark’s integration with Obsidian using Hookmark’s Script Editor.

Using the default integration between Hookmark and Obsidian

When you use the default integration with Obsidian, Hookmark’s Copy Link and Copy Markdown Link will return obsidian:// links. When you hook items together, using the menu bar icon or Hookmark’s contextual popup window, Hookmark will also use obsidian:// links for the note.

For most people this will be sufficient.

Summary of tradeoffs between URL schemes

Feature default “advanced URI” hook://file/
Avoids needing to install advanced plugin x
Avoids needing to change a Hookmark Preference x x
Supports Hook to New > Obsidian
Supports Hookmark’s Reveal File in Finder x x
Opens links/hooks directly in Obsidian x (in default app or Finder)
Can move files in same vault x
can move the file to a different vault, or anywhere on your Mac, and the links will still work x x
If you switch away from Obsidian to a different app, your links will still work x x
Avoids adding info to the body of the note file x

Benefits of the default integration with Obsidian

  • Works outside the box; no configuration of Obsidian or Hookmark required.
  • Works with Hookmark menu bar icon (not the case for the “advanced URI” or “hook file” integration with Obsidian).
  • Links generated by Hookmark can be used across devices even without Hookmark (e.g., on Windows or iPhone), as long as you sync your Obsidian files properly.

Limitations of default integration with Obsidian

There are some limitations to the default integration which are due to the fact that Obsidian is an Electron app that lacks a built-in API that Hookmark can use to get the file path and name of the current note, and to create new notes. With the default integration:

  1. You won’t be able to use Hookmark’s Reveal File in Finder feature in Obsidian. You’ll need to use Obsidian’s UI which it calls (Show in system explorer) or a custom keyboard shortcut in Obsidian.
  2. If you rename files or move them to a different vault, Obsidian links break.
  3. If you migrate from Obsidian to a different note-taking app, you won’t be able to use your (obsidian://) links.

NB:

  • You can overcome limitation 2 by using the the advanced URI scheme described in the next section, or by using the hook file (hook://file/) integration scheme.
  • You can overcome limitations 1, 2, and 3 by using the hook file (hook://file/) integration scheme.

Using the “Advanced URI” integration between Hookmark and Obsidian

There is a free Obsidian community plugin integration called “Advanced URI” made by Vinzent. This plugin provides a number of useful functions. The main effect of this plugin is to change the URI scheme of notes within Obsidian itself to obsidian://advanced-uri. The main benefit of this plugin compared with the default is that, whether you use Hookmark or not, links created with it are robust, meaning you can move the notes around within the same vault (not between vaults, let alone outside Obsidian) and the links will still work. The table above lists the other benefits.

This plugin works by adding an ID to any Obsidian file to which it generates links. For example, it may add the following to top of the file:

---
id: 2d73ce68-9e27-4463-8d21-443bc4a9cb02
---

When you create a link with this plugin installed, the link’s address (URL) includes the ID of the file. An example is obsidian://advanced-uri?vault=myVault&uid=2d73ce68-9e27-4463-8d21-443bc4a9cb02. Notice the “UID” field. (The “UID” keyword is configurable in the plugin’s settings).

If you would like Hookmark to use the “advanced URI” integration, you’ll need to:

  1. Install the “advanced URI” plugin from within the Obsidian app. Search for “Advanced URI” in the community plugin browser interface. See Plugins mini FAQ.
  2. Enable Use UID instead of file paths in the Advanced URI plugin’s settings. To get there, you can use the gear menu at the bottom right of the plugin’s UI. Or click on Obsidian > Settings > Advanced URI. You can also configure the UID field in frontmatter field (e.g., with ui or uid.
  3. Issue the following command from the /Applications/Utilities/Terminal app:

defaults write com.cogsciapps.hook integration.obsidian.URL.scheme obsidian-advanced-URI

To learn more about this plugin, visit Vinzent03/obsidian-advanced-uri: Advanced modes for Obsidian URI.

If you configure Hookmark to use the Advanced URI integration scheme with Obsidian, then whenever you link items with Hookmark (whether via Copy Link, Copy Markdown Link, or Hook to New) then the links created will be of the form obsidian://advanced-uri.


How to switch between integration schemes

Using /Applications/Utilities/Terminal you can manipulate the URL scheme (“integration.obsidian.URL.scheme”) used by Hookmark with Obsidian.

  • defaults write com.cogsciapps.hook integration.obsidian.URL.scheme obsidian-default
  • defaults write com.cogsciapps.hook integration.obsidian.URL.scheme obsidian-advanced-URI
  • defaults write com.cogsciapps.hook integration.obsidian.URL.scheme hook-file

Using the hook://file/ URL scheme with Obsidian

To use the hook://file/ URL scheme with Obsidian you simply need to do this from the command line:

defaults write com.cogsciapps.hook integration.obsidian.URL.scheme hook-file.

Advantages of hook://file/ scheme over the advanced URI scheme (and the default):

  1. You can move the file to a different vault, and anywhere on your Mac, and the hooks will still be there. In fact, all your hook://file/ links should track the file.
  2. Reveal File in Finder works.
  3. If you switch away from Obsidian, your links will still work.

Disadvantage of hook://file/ scheme in Obsidian: hook://file/ links cannot be opened directly in Obsidian. They will open in the default app or be revealed in the Finder.

“Can I switch integration schemes later?”

The links generated by Copy Link and Copy Markdown Link will continue to work even if you switch schemes.

However, for any given Obsidian note, you will not see any “hook” (in the Hookmark window) that was associated with this note if it was generated when a different scheme was in place. (That’s because hooks are based on URI address of the item). If you change back to the other scheme, the hooks will appear again. Regardless, you should be able to find the link in Hookmark’s search, which is context agnostic.

Other information

Forum discussion

See Link Obsidian with AdvancedURI Plugin for the discussion that led to the advanced URI integration.

There are other discussions about Obsidian on the Hookmark Forum.

Customer support for Obsidian integration

Please note that the “advanced URI” plugin is created by a third-party developer. CogSci Apps Corp. is not responsible for it and may not necessarily provide support for it. You should direct your questions about it to the Obsidian forum or Hookmark forum.

Default Obsidian integration is also limited due to the fact that Obsidian’s linking API does not meet the requirements of the Manifesto for Ubiquitous Linking, as noted above.

Gratitude