Support GFM style #kebab-case-heading-slug anchor targets

Use case or problem

I’m trying to use Obsidian to browse and maintain a repository of related documents that link to each other in a way compatible with GitHub, Bitbucket, VS Code, and internal tools:

## This is an Internal Heading

[This is a link to the internal heading](#this-is-an-internal-heading)

If I try to follow such a link in Obsidian, it fails:

Unable to find selection in this-document-filename

If I alter the links to use Obsidian’s preferred anchor target, users of other tools can’t follow the links:

[This link to the internal heading works in Obsidian only](#This%20is%20an%20Internal%20Heading)

Proposed solution

I’d like a repository setting useSlugsForHeadingAnchors which, if set true, altered Obsidian’s behaviour to:

  • Generate a slug for each heading in a manner compatible with GitHub’s Markdown rendering
  • Render headings with an anchor using that slug
  • Render inserted links with a target using that slug

Example rendered output given our original Markdown might be:

<h2><a id="this-is-an-internal-heading">This is an Internal Heading</a></h2>

<a href="#this-is-an-internal-heading">This is a link to the internal heading</a>

Current workaround (optional)

I can’t find a workaround.

Related feature requests (optional)

I can’t find related feature requests.

2 Likes

So, basically, github-compatible links, right?

Yes please! Can we have this?

Super convenient.

I would really appreciate this feature as well.