Better Markdown Links

approved

by Michael Naumov

Adds support for angle bracket links and manages relative links properly

53 stars17,133 downloadsUpdated 11d agoMIT

Better Markdown Links

Buy Me a Coffee GitHub release GitHub downloads Coverage: 100%

This is a plugin for Obsidian that adds support for angle bracket links and manages relative links properly.

Demo vault

A demo vault with usage examples ships with every release. You can access it via any of the following:

  1. Running the Better Markdown Links: Open demo vault command.
  2. Downloading better-markdown-links.demo-vault.zip from the Releases.
  3. Browsing its source in demo-vault/ in this repository.

Angle Bracket Links

Markdown links [Title](path/to/note.md) are better for compatibility purposes as [[Wikilink]] is not part of the Markdown spec.

However, links with spaces [Title](path%20with%20space/note%20with%20space.md) are quite unreadable.

The Markdown spec allows more readable links [Title](<path with space/note with space.md>), which work fine in Obsidian, but Obsidian doesn't generate such angle bracket links.

This plugin makes Obsidian generate angle bracket links.

Relative Links

There is a problem in Obsidian where relative paths might be incorrectly resolved as absolute paths, causing the same link to behave differently in Obsidian and other Markdown editors.

This plugin ensures that relative paths are prepended with ./, e.g., [Title](./path/to/note.md), to overcome the above-mentioned problem.

File Link Normalization

External file:// links are often stored in an inconsistent, hard-to-read form — with %5C-encoded (or literal) backslashes, e.g. [note](file:///C:%5Cnotes%5Ctodo.md).

When the Should normalize file links setting is enabled (the default), this plugin normalizes such links to a pretty form (decoding and converting backslashes to forward slashes), e.g. [note](file:///C:/notes/todo.md), whenever links are converted — both via the convert commands and via the automatic conversion triggers. Other (non-file://) links are left untouched.

Link Conversion

This plugin adds the ability to convert all links in an individual note or the entire vault.

Automatic Link Conversion

This plugin adds the ability to automatically convert links to the selected format. The Convert links setting controls when this happens, with each option being cumulative (it also includes every option above it):

  • On explicit command — only when a convert command is invoked. No automatic conversion happens.
  • On save command — additionally when the Save current file command runs (usually bound to Ctrl + S).
  • On auto save — additionally on the implicit auto-save (usually every 2s).
  • On every modification — additionally on every file modification, including changes made outside Obsidian.

Use one of the save-based options if the older "convert as you type" behavior felt too eager and moved your cursor while editing — those convert only when the file is saved.

Automatic handling rename/move

This plugin adds the ability to automatically update links to the renamed or moved to another directory files.

To improve performance, consider installing Backlink Cache plugin.

Extend app.fileManager.generateMarkdownLink()

This plugin enhances the app.fileManager.generateMarkdownLink() function by adding an additional overload.

If you want to use the updated functions from your plugin, you can copy GenerateMarkdownLinkExtended.d.ts into your code.

Integration with other plugins

This plugin is handling rename/delete events based on the plugin settings. Similar handlers are added to other plugins:

But those handlers are designed to work fine with each other and the plugins can be installed together.

Installation

The plugin is available in the official Community Plugins repository.

Beta versions

To install the latest beta release of this plugin (regardless if it is available in the official Community Plugins repository or not), follow these steps:

  1. Ensure you have the BRAT plugin installed and enabled.
  2. Click Install via BRAT.
  3. An Obsidian pop-up window should appear. In the window, click the Add plugin button once and wait a few seconds for the plugin to install.

Debugging

By default, debug messages for this plugin are hidden.

To show them, run the following command:

window.DEBUG.enable('better-markdown-links');

For more details, refer to the documentation.

Support

Buy Me A Coffee

My other Obsidian resources

See my other Obsidian resources.

License

© Michael Naumov

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.