Changing obsidian link format for wikilink with headings

I edit markdown files in neovim using the ‘Marksman’ LSP. With this tool, it makes Anchor links that look like [[MyFile#some-heading]] However in Obsidian, it only works with links that look like [[MyFile#Some Heading]]. How can I make Obsidian work with Marksman-style links?

What does the actual heading look like in your note? Is it actually “Some Heading” in the file, and Marksman changes it to “some-heading” in the link?

In the markdown file, the text for the H2 is “## Some Heading”. Most tools ‘slugify’ the header to build the anchor link (eg <h2 id=”some-heading”>Some Heading</h2>).

OK so I just learned that the Obsidian desktop client is closed source - can’t study the code to learn how link resolution is done, can’t submit a PR. Sad! Can I write a plugin to alter the behavior of obsidian links? Is there a ‘register a custom link resolver’ hook? There are two issues: navigation and link/hover styling. Could I run the file thru a text converter in a before-read/before-write hook? Have others written link-rewriting plugins?

For wikilinks [[ ]], there is no format for links to headings. Obsidian made up one without slug.

For standard markdown links [](), there are competing formats. Github uses one with hyphens, Obsidian does not.

Thanks for the relevant link - much appreciated. An open issue for four years! Looks like Obsidian has it’s own walled garden strategy, deliberately breaking interoperability. If you change your stance, hit me up and I’ll give input for a solution and can prototype/test. A couple of small API changes (before-read/before-write hooks) and plugin writers could easily resolve this for your users.

Believe it or not this was not deliberate. In the beginning, in 2020, we only had only wikilinks and we didn’t support links to headings or blocks. Then there was a push from users to add links to headings and to blocks. Then there was some push to also support standard markdown links and for that we reused most of the code that is used for our wikilink implementation, which was not ideal for different reasons we discovered afterwards.

Regarding specifically anchor links to headings. It is not defined in CommonMark, the standard we try to follow. GitHub made something up and we ended up making something up around the same time.

No fix in four years. Still no willingness to address the issue. The intent to break interoperability is very much deliberate. No problemo I’ll build workaround. If you change your stance and would like user feedback & testing, I will volunteer. :wink:

For wiklinks, we are not going to change the format. For markdown links, you can follow the FR I linked in the previous post. Thanks.