Link to a subheader in another note

This is tightly related to Block reference, but much simpler to add as a feature.

Why can’t we link to a subheader located in another note? Let’s say you have a note with “three principles of X”, each principle being its own subheader (## Principle 1 and so worth).

If you’re writing another note and want to reference just one of such principles, I don’t see the point of having to separate the “three principles of X” into three separate notes in order to be able to reference a specific one.

This seems plausible to achieve using Markdown/HTML by writing something like [[three principles of X#Principle One]] (or in HTML: <a href="three-principles-of-x#principle-one"></a>, so in theory it could work across Markdown editors.

It could also be used as a stop-gap until a consensus on block references is established, allowing users that want to use them to add some less important header (like ###### header I want to reference) and being able to link to it from another note, though it may reduce the readability of notes for those that would be heavy users of this feature.

If I understand your request correctly, this functionality already exists. Anytime to link to a page, you can link to any heading used inside that page with the # symbol after the page name.

If I create a file called “cooltopic.md” in which I have the following markdown:

# Cool Topic
## Intro
Intro paragraph
## Point 1
paragraphs about how cool the topic is
## Point 2
paragraphs about how well researched topic is
## Point 3 
paragraphs about how logical the topic is 
## Conclusion 
Conclusion paragraph.

I can link to the topic in the following ways:

  • I can link to the file/topic in general with [[cooltopic]]
  • I can link to a specific part of the page with [[cooltopic#Point 1]]
  • I can embed the section with ![[cooltopic#Conclusion]]
  • I can change whatever is shown as the link text with the pipe.
    • Example: [[cooltopic#intro|this idea I had]]
    • This would allow a link to this cool idea I had without being locked into using the title of the page.

Hope that helps.

3 Likes

Ah, you are correct! I could’ve sworn I’ve seen an example of this somewhere some time ago, but I didn’t manage to figure out how to do that.

No problem. With links like these, I’d recommend turning on the “Page Preview” plugin if you haven’t already. Mouse over a link (or ctrl/cmd and hover while in edit mode) and a pop-up will show you a preview of the link. Super useful for quick reference especially when combined with calling a specific heading.

1 Like