Another option could be to use compact stable element IDs not based on the content. This would be less readable, but on the upside there wouldn't be any collisions, and links wouldn't break on minor heading changes.

On Tue, Oct 27, 2015 at 2:04 PM, Subramanya Sastry <ssastry@wikimedia.org> wrote:
On 10/27/2015 03:48 PM, Gergo Tisza wrote:

​If you care about edge cases, section anchor generation is rather complicated: anchors can be postfixed with an index when there are multiple identical titles,

This would need to be handled to guarantee id uniqueness.

and HTML, templates and parser tags are handled differently for display and for anchor generation. (Yes, these can and do appear in titles. E.g. people sometimes put <math> tags in there, or italicize a word.)

But, if we move core and Parsoid to HTML5 ids, this shouldn't matter since the only restriction on HTML5 ids is that they shouldn't contain a space char as per https://html.spec.whatwg.org/multipage/dom.html#the-id-attribute

Subbu.



--
Gabriel Wicke
Principal Engineer, Wikimedia Foundation