Better support to link sub headings

What I’m trying to do

ok here is how I type my documents

Work TO DO

  • Exam

    • [[DSA Nov2023PYQ.pdf]]

    • Questions{2hr}
      • unit 2
        • Q4
        • Q5
      • unit 3
        • Q6
        • Q7
      • unit 4
        • Q8
        • Q9

I want to be able to link to the exam heading or to the dsa heading

and also I want a preview of the thing

Things I have tried

I read online the docs and learnt this
[[name_of_File#heading]]
but I can’t seem to link the sub heading

thanks

here is how it looks in source mode

You need use block links: write [[^ to link blocks in the same file. Example:

- ## Heading 1
	- content
- ## Heading 2 ^074755
	- content

[[#^074755|My link]] 

The main issue why you can’t link to those “headings” are that you’ve placed them within lists. And Obsidian doesn’t recognise headings within lists. To showcase if you place the following in a file:

# Work to do

- ## Exam (in list)
    - #### [[2024-12-07 29]] Questions (in list)
        - unit 2
        - [ ] Q4
        - [ ] Q5

## Exam (outside of list)

#### [[2024-12-07 12]] Questions (outside of list)

- unit 3
    - [ ] Q6
    - [ ] Q7

And then look at the outline of this in the right sidebar (if you’ve got the core plugin Outline enabled), you’ll see:
image

It believes there are only three headings in this file. Those in the list is not included. The same applies if you trigger the autocompletion as shown below:

image

Here you see that only the headings outside of the list context are shown, and eligible for a link target.

1 Like