Add Anchor ID to Text

Did this ever become a reality?

I can see deep links to Headings working in my TOS. However, when I try to create deep link to inline elements, such as span or anchors, the ID is stripped from the tag, making the link useless.

Is it only possible to link to header elements?

1 Like

I’m pretty sure it works?

If you tap on the header above a link icon should appear on the left.

I also use eg. <a name="anchor"></a>, and they work too.

Add Anchor ID to Text - #2 by JammyDodger



    :point_left: hidden anchor

(anchor zips to here ish)

1 Like

how are you generating the link and the anchor. I’m trying to follow the usage in the terms of service table of contents. When I save the post and use the dev inspector to look at the code I can see that the tag has persisted but the attributes have been removed.

For the headers I just use the # markdown code for header, and the forum does the rest.

### Anchor Header

Anchor Header

And then when I grab the link from then icon I get

https://meta.discourse.org/t/add-anchor-id-to-text/201393/4#anchor-header-1

I’m afraid I don’t use them in tocs (though I thought the TOC also did them automatically for you based on the same principle?)

4 Likes

OK. thanks for the explanation. I’ve been able to reproduce that and it’s working.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.