Community Wishlist Survey 2022/Editing/Native support for alternative section anchors

Native support for alternative section anchors

  • Problem: In order to create shorthand or stable links to sections, editors create fragment IDs (aka anchors) that point to sections that differ from the visible headings. This can be done using {{anchor}}, as in == {{anchor|Anchor}} Heading ==, or its substituted form, == <span id="Anchor"></span> Heading ==, but the first results in bad section links—as in /* {{anchor|Anchor}} Heading */, which shows up as →{{anchor|Anchor}} Heading—while the second is less self-evident as to what it's for, especially to newcomers. Another solution is to put the {{anchor}} or <span>...</span> at the end of the previous section, but this doesn't show up when editing the section (and shows up at the end when editing the previous), which is quite confusing.
  • Proposed solution: We need a way to add fragment IDs inside section headings that 1) communicates clearly what it's doing and 2) doesn't affect section links. E.g. a parser function like {{#sectionanchor:Anchor name}} that can be used anywhere inside a section and results in <span id="Anchor_name"></span> prepended at the top of (or inserted before) the nearest Hn element before the function call.
  • Who would benefit: Editors
  • More comments:
  • Phabricator tickets:
  • Proposer: Nardog (talk) 07:00, 21 January 2022 (UTC)

Discussion

  • This is something that'd definitely be nice, but I'm not sure it rises to the level of importance for me to give it a support. If something was done, perhaps the software could just take templated anchors in section headers and not display them in edit summaries. {{u|Sdkb}}talk 23:53, 28 January 2022 (UTC)
  • If stable section fragment IDs are needed, the software should just create them automatically, without any user involvement. Also, the rendered page should have links to them, so the links can be easily copied. Silver hr (talk) 19:49, 1 February 2022 (UTC)
    Putting anchors heading is common after renaming a section, but still wanting old links to go to the section. Jochem van Hees (talk) 17:22, 3 February 2022 (UTC)

Voting

  •   Support OwenBlacker (Talk) 22:24, 29 January 2022 (UTC)
  •   Support Thingofme (talk) 15:35, 30 January 2022 (UTC)
  •   Support Anchors currently look really bad in headings Jochem van Hees (talk) 17:21, 3 February 2022 (UTC)
  •   Support Ynhockey (talk) 01:08, 6 February 2022 (UTC)
  •   Support --Ciao • Bestoernesto 18:43, 6 February 2022 (UTC)
  •   Support I like the idea; I feel like more examples could be given in the proposal, though, such as an example of what such a link would look like vs. how a section title might change. paul2520 (talk) 23:31, 6 February 2022 (UTC)
  •   Support Uanfala (talk) 12:38, 7 February 2022 (UTC)
  •   Support Would be very useful in translatable text where we use {{anchor}} a lot Quiddity (talk) 07:53, 10 February 2022 (UTC)
  •   Support Gaurav (talk) 06:21, 11 February 2022 (UTC)