This plugin enhances your Obsidian experience by improving the behavior of internal links to headings within the same note, both in Live Preview (editing mode) and reading mode.
- Seamless Navigation: Click on a Markdown link to a heading (e.g.,
[My Heading](#my-heading)) and be instantly taken to that heading, just as you would in reading mode. - Editing Mode Support: Specifically designed to address the issue where clicking a heading link in Live Preview would open the link for editing rather than navigating to the destination.
- Maintains Core Functionality: This plugin only activates on internal heading links, ensuring that Obsidian's default behavior for other links (e.g., links to other notes or external websites) remains unchanged.
The plugin listens for click events on the document. When a link with an href that starts with # is clicked, it intercepts the default browser behavior and manually scrolls the user to the correct heading. It does this by:
- Extracting the heading's "slug" (the lowercase, hyphenated version of the heading text) from the
href. - Searching the active note's metadata cache for a heading with a matching slug.
- Using Obsidian's API to open the current file and navigate to the found heading.
- Clone this repository into your Obsidian plugins folder (
your-vault/.obsidian/plugins/). - Run
npm installandnpm run buildfrom the plugin's directory. - Enable the "Slug Link Follower" plugin in the Obsidian settings under Community plugins.
Alternatively, once the plugin is approved and available on the community list:
- Open Obsidian's Settings.
- Go to Community plugins and click Browse.
- Search for "Slug Link Follower".
- Click Install, and then Enable.