5

I figured this had been asked by now, but I guess not, or maybe I didn't find it when I was searching.

I commonly want to provide anchor links in answers (esp. when creating footnotes), but SO flavored Markdown has a whitelist of allowed tags and that's never supported the name attribute of the a tag before, so I've been unable to use #name to directly link to a footnote.

The switch to CommonMark obviously means a pretty significant change in the Markdown rendering engine, so will the current whitelist of pure HTML remain as it is or will things be changing around with that and if they're changing, will this restriction be relaxed?

Similar questions have definitely been asked in the past (e.g. Allow linking to named anchors and Support anchor names in posts) but none since the switch.

7
  • 2
    Does CommonMark has a spec for named anchor tags? One of the challenges that remains is keeping those names/ids unique on a single page when a question and several answers can now introduce ids/names.
    – rene
    Commented Jun 7, 2020 at 20:33
  • 2
    @rene not as far as I'm aware. It also doesn't have tables but people seem convinced we should implement them. :(
    – Catija
    Commented Jun 7, 2020 at 20:39
  • @Catija yeah, I checked the specs 6 to 8 months ago for anchor id support and only found an item in the issue list and a lengthy discussion. None of that seemed close to be ready for a spec, let alone implementation. Haven't checked back later, hence my comment.
    – rene
    Commented Jun 7, 2020 at 20:45
  • @rene The difficulty of conflicting names is definitely real, although it'd be worth seeing how much of an issue it actually is in practice. I'm not so much asking about the named anchors in done in Markdown, since that seems to be a huge can of worms, but rather named anchors as done in raw HTML (i.e. as <a name=...>...</a>).
    – b3m2a1
    Commented Jun 7, 2020 at 20:47
  • 3
    @rene yeah, I've been poking around at their Discourse since I stumbled across it. To be fully transparent, we definitely have markdown that's non-standard still... easiest example is spoilers. We're supporting it moving forward but, eventually, if it gets implemented, we'll have to migrate to the standard (assuming they don't just use ours, which is a possibility).
    – Catija
    Commented Jun 7, 2020 at 20:48
  • 1
    To keep them unique on the page, it's reasonable to just prepend all of the anchors in a post with the post's ID (e.g. 349076-some-special-section).
    – Makyen
    Commented Jun 8, 2020 at 0:41
  • No, not right away anyway. Existing FR: meta.stackexchange.com/q/89314/332043 Commented Jun 8, 2020 at 7:48

0

You must log in to answer this question.

Browse other questions tagged .