If an anchor isn't explicitly supplied then one is generated, but based on the headings' current position within the document, rather than the name of the heading. I've worked around this issue locally by replacing:
anchorId = config.anchorPrefix + tocLevel + '-' + tocSection;
with:
anchorId = encodeURIComponent(config.anchorPrefix + el.text().toLowerCase().replace(/ /g, '-'));
but obviously any proper solution would need to handle the case where the same heading name had been used multiple times (e.g. for a sub-heading), in which case the positional information could be included again to disambiguate.
If an anchor isn't explicitly supplied then one is generated, but based on the headings' current position within the document, rather than the name of the heading. I've worked around this issue locally by replacing:
with:
but obviously any proper solution would need to handle the case where the same heading name had been used multiple times (e.g. for a sub-heading), in which case the positional information could be included again to disambiguate.