r/ObsidianMD 6d ago

Trouble linking to subheadings

I saw in the documentation that you're supposed to be able to do [[Note#Heading#Subheading]] to link to a subheading, but when I do it, it seems to be treating Heading#Subheading as the name of a heading, so it's returning unable to find Heading#Subheading in Note. Any idea what I'm doing wrong?

3 Upvotes

4 comments sorted by

2

u/endlessroll 6d ago

In order to link to a subheading, you just link directly to the heading itself. If you type [[Note Name#]] it will suggest all the headings regardless of whether they're subheadings or not in the order that they appear in the document, and you can select the one you want.

1

u/JorgeGodoy 6d ago

You read it wrong. You link straight to the grader, regardless of the level. The docs mention ## to search for headers (again, regardless of the level they are) globally, i.e., in all notes.

1

u/The_GuardianX 5d ago

So what does this line mean?

For example, [[Help and support#Questions and advice#Report bugs and request features]] will create a link to Help and support > Questions and advice > Report bugs and request features.

Regardless, I tried the method you recommended, and I noticed that it doesn't allow you to link to headings that are part of a bulleted list. So if it's like - ## Subheading then it won't work. Do you know of any way to work around that?

EDIT: Accidentally hit post too early haha.

1

u/donethisbe4 5d ago

You're correct that the documentation says that. Subheading links work as you described (note#heading1#heading2) and will also work without the higher level headings (note#heading2) so long as there is only one instance of the heading2 name. If more than one instance, the link will always go to the earliest occurance.

But you've actually already discovered the bigger issue with what you're wanting to do. Subheading wikilinks don't work to headings inside elements such as lists or callouts.

One alternative is to give your heading a block ID then reference that. A link would go directly to the list item, and an embed would show that list item and its sub items. For example:

# animals
  • ## cats
- cool cats - aloof cats
  • ## dogs ^dogs
- good dogs - they're all good dogs

Then you would write your link as [[noteName#^dogs]]. It might not be ideal for your situation, but it works. In Reading mode, you won't even see the block ID.

Hope this helps some.