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

From Meta, a Wikimedia project coordination wiki

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)[reply]

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)[reply]
  • 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)[reply]
    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)[reply]

Voting