• When TOC block is inserted it completely messes up anchor links on all headings.

    • It should check if there are anchor links present on headings first and if so, it should not touch them and use them as-is.
    • When creating anchors it should remove diacritics from letters instead of turning them into a url encoded mess (e.g. turn “?” into “r” instead of “%C5%99”).
    • It should not add numbers at the beginning of the anchors. Thant is not a nice anchor there. It might add numbers at the end in case there is a duplicity or better not at all, header duplicity is users fault.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Alexis Pandaan

    (@alexius08)

    Hi @kub1x ! Thanks for letting us know.

    1. Are you referring to preserving the user’s custom anchor texts for the headings? If so, it’s something we might consider to add in a future version of the plugin.
    2. We already have the option for that. While a Table of Contents block is selected, go to the Inspector panel and look for “Remove diacritics in anchor links” under “Additional settings”.
    3. We deliberately added the numbers to ensure that there will be unique anchor texts at all time. We update the anchor texts while the headers are being edited right in the editor. Constantly checking for duplicates might slow down the block, especially if it is detecting many headings in the page, so performance concerns would be taken into account if we go ahead with doing this (especially when avoiding duplicate anchor texts when we use the user’s custom anchor texts).
    Thread Starter kub1x

    (@kub1x)

    Hey, thanks for the prompt reply.

    1. Yes. Overriding user defined anything (heading anchor in this case) as a side effect of anything (adding a TOC block) is a poor practice. I’ve lost a lot of anchors and only figured it later by visiting a link broken this way. For me not checking if the anchor is not already defined is a huge bug.
    2. Nice. I’d have that on by default.
    3. I do understand your concern. I would just not do the checks and leave the dupes to the user, since it is not a good practice to have duplicate headers anyways. Maybe I’d just highlight the duplicate links in the TOC (on a debounced check with a linear complexity so not that complex after all).

    It is all just a thought. I want to have nice and readable anchor texts and here with UB I can’t get rid of the unnecessary numbering and/or enter/alter the anchors manually (which is also weird – the anchor edit boxes aren’t disabled, yet the editing does not work).

    I do like the look and controlls of the block though. Hope this feedback is of any use to you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Table of Contents messes up anchor links’ is closed to new replies.