Heading link compatibility

Yes, I’ve tried it both ways - using a Github flavor heading id with an empty <div> id equal to the Obsidian heading id as well as an Obsidian heading id with an empty <div> id equal to the Github flavor heading id. And I tried it with the <div> before and after the heading.

Here is my latest test, using the Obsidian heading id with an empty <div> after the heading for Github. This works in Obsidian, as you would expect, but Github doesn’t pick up the <div> id like you would hope:

- [Pokemon Overview](#Pokemon%20Overview)
- [See Also](#See%20Also)

## Pokemon Overview
<div id="#Pokemon%20Overview"></div>

## See Also
<div id="#See%20Also"></div>

If I put the empty <div> before the heading then it doesn’t work in Obsidian. It seems like it should but Obsidian isn’t seeing the <div> id. I don’t think Github is either.

Thanks for trying to help me. Until a solution is conceived I am using the workaround of:

  • Reduce headings to a single word where that makes sense
  • Replace spaces with underscores in headings with spaces
  • Use Github flavor heading ids in internal links

That workaround isn’t so bad. I realized that many of my headings were actually clearer as a single word and those that are better with multiple words do not suffer that much using underscores.

But, it is a mess. Even the CommonMark spec is not clear on this. Everybody is just doing whatever they want. There should be a standard.

1 Like