Add settings to control link resolution mode

Use case or problem

Consider vault with the following files

A.md

Absolute path resolved A

Folder/A.md

Relative path resolved A

Folder/B.md

Wikilink [[A]] resolves to the root `A.md` rather than to the relative one `Folder/A.md`

Same issue with the markdown link [A](A.md)

Originally, I raised this is as a bug but later on I was told it is an intentional behavior.

By its nature, markdown was built to use relative paths. The users who want to maintain the maximum portability of the vault, usually disable Use [[Wikilinks]] Obsidian setting and switch New link format setting to Relative path to file. This makes possible to comfortably edit your notes in any markdown editor.

Current behavior of Obsidian link resolving differs from the way markdown editors work. I checked in Visual Studio Code and in Typora. There if you follow the markdown links from Folder/B.md they will redirect to Folder/A.md unlike current Obsidian’s behavior.

While it is understandable why did Obsidian make this design choice, I think it would be very handy if we can alter the default behavior via some setting.

Proposed solution

Add Link resolution mode setting to Obsidian: with the following options

  • Absolute path first, fallback to relative path (Default)
  • Relative path first, fallback to absolute path
  • Absolute path only
  • Relative path only

Current workaround (optional)

There exists a workaround to explicitly specify the type of the links

[[/A|A]] and [A](/A.md) resolve as absolute link path

[[./A|A]] and [A](./A.md) resolve as relative link path

However such workaround has its own issues, and it’s better for it to be addressed on the Obsidian dev level

Related feature requests (optional)

1 Like

As, unfortunately, the original bug was closed, I will provide my explanation here.

I am sure that this behavior is the violation of the Obsidian team’s claim

Obsidian strives for maximum capability without breaking any existing formats. As a result, we use a combination of flavors of Markdown.

As a proof of violation of the mentioned principle

  1. Open attached vault (2.9 KB) in Obsidian
  2. Go to Folder/B.md note
  3. Observe behavior of each link
  4. Open Folder/B.md in any other markdown editor
  5. Observe behavior of each link
  6. Notice the difference in steps #3 and #5

I understand why it might be undesirable for the Obsidian team to change behavior of the link handling, even if it breaks the markdown spec. I understand that just correcting the behavior might break existing vaults. That’s why I suggested to make the link resolution configurable.