Version 1.444.0 auto generated header ids break inline HTML

Hello! I was testing an upgrade from 1.141.0 to 1.144.0 locally and noticed that the 24cc255 appears to have changed how Hugo generates IDs for some headers that include inline HTML.

For example, in one of our upstream repositories we have a header defined as:

### <a name="dispatcher-heartbeat"></a> Configure node healthcheck frequency (--dispatcher-heartbeat)

Under Hugo 1.141.0, this generated an anchor ID of dispatcher-heartbeat as expected. However, after upgrading to 1.144.0, the generated ID becomes something like a-namea-configure-node-healthcheck-frequency---dispatcher-heartbeat, which breaks our hash links.

Interestingly, other headers on the same page that also use inline HTML continue to generate the expected IDs and work correctly. For example:

### <a name="advertise-addr"></a> Specify interface for outbound control plane traffic (--advertise-addr)

Could you please help clarify the following:

  • Is this new behavior with inline HTML in headings intentional?
  • What factors might be causing the discrepancy where some headers are affected and others aren’t?
  • Are there configuration options or recommended workarounds to either revert to the old behavior or ensure consistent heading ID generation?
  • What is the best approach to update existing content that relies on inline HTML anchors?

Any guidance you can provide on how to address this issue would be greatly appreciated.

Thank you for your help! :grinning:

To override an automatic heading id use a Markdown attribute. For example, do this:

## My section title {#foo}

Not this.

## <a name="foo"></a> My section title

Including anchor elements (even those without inner content) in headings is not something you want to do.

3 Likes