Named anchors once again

Hey all,

Sorry, I spent 30 minutes already trying to make it work, so I figured I’d ask, even though I am sure this topic came up earlier. I just couldn’t find it.

My question is, how do I give a link to an anchor? I assume, the answer would be different in 2 cases:

Case A. the anchor is in a header
Case B. the anchor is elsewhere.

I am currently interested in Case A. I assume, one could approach it by putting the anchor into a separate paragraph, thus making it essentially case B, but I wouldn’t like to have an empty space before of after every heading.

What I tried for the anchor:

# <a name="anchor"></a>My header
# <a id="anchor"></a>My header
# My header ^anchor
 ^anchor
# My header
# My header
 ^anchor
# My header {#anchor}
{#anchor}
# My header
# My header
{#anchor}

What I tried for the link:

[link](#anchor)
[link](#^anchor)
[#anchor]
[#^anchor]
[[#anchor]]
[[#^anchor]]

So far, nothing worked.

 
You cannot. You can make anchors for blocks.

https://help.obsidian.md/links#Link+to+a+block+in+a+note:

A block is a unit of text in your note, such as a paragraph, block quote, or list item.

You can link to a block by adding #^ at the end of your link destination followed by a unique block identifier. For example, [[2023-01-01#^37066d]].

 
I tested and following works for headings (=blocks):

  1. ## my heading ^anchor

  2. ## my heading
    ^anchor
    
  3.  ## my heading
    
     ^anchor
    

However you can link to headings in a special way.

https://help.obsidian.md/links#Link+to+a+heading+in+a+note:

You can link to specific headings in notes, also known as anchor links.

Linking to a heading within the same note

To link to a heading within the same note, type [[# to get a list of headings within the note to link to.

1 Like

Thank you @blue_emperor, particularly for the links! I managed to make the anchors work