How can I make this HTML work inside Obsidian?

I want to create a simple HTML TOC inside Obsidian, but when I click on the first element it doesn’t go to the h2 heading, instead it asks me if I want to open an external link.

<a href="#First_Point_Header">1 First Point Header</a>

<h2 id="First_Point_Header">First Point Header</h2>

What happens if you click “OK”?

It says that I need an app to open the link and suggest searching on the windows store.

Huh, weird. Does the same thing happen when you try it in the sandbox vault?

I tried your example on iOS. When I tap the link in Live Preview it just shows the code for editing. When I tap it in Reading View nothing happens. There might be a bug, or Obsidian might not support it. Maybe search the forum for something like HTML fragment links

Markdown works:

- [[#First Point]]
- [1 First Point](#First%20Point)

## First Point

Yeah, the markdown version works. It doesn’t work in the PDF, however. That’s way I was looking for the HTML. Maybe it works in PDFs

Are these PDFs made from Obsidian notes (using export to PDF or whatever the feature is)?

Using the built-in export.

OK. If the Markdown doesn’t work in them then I expect the HTML won’t, either (but try it to be sure). I avoid PDFs as much as possible, so I can’t offer much help. I would have expected both the Markdown and the HTML to work in exported PDFs.

1 Like