Table of contents not working in Obsidian Publish

What I’m trying to do

I’d like to include a table of contents at the top of a page in Obsidian Publish.

Things I have tried

The md code below works properly in Obsidian but not in Obsidian Publish:

  • [[#section 1|section 1]]
  • [[#section 2|section 2]]

section 1

section 2

Am I doing something wrong ? How is it possible to include a table of contents at the top of a page published with Obsidian Publish? Many thanks for any hints!

Outline mode is an option.

However, assuming you are using that space for something else, you’ll need to create a full link.

For example, on my Create Via a Code Block Page, I will need to create a this link: [[Create via Code Block#Name|Name]]. On Publish, it will show correctly.

Obsidian auto wikilink completion will fight tooth and nail to say it can’t autocomplete the #name part. Ignore it, type it in manually, add your manual alias, and move on.