Description
What version of Hugo are you using (hugo version
)?
$ 88.1
Does this issue reproduce with the latest release?
Yes - this is the latest version
If I have a markdown header which begins with a number Hugo generates an id beginning with a number. For example ## 1 Test
generates <h2 id="1-test">1 Test…</h2>
According to w3.org (https://www.w3.org/TR/CSS21/syndata.html#characters) In CSS, identifiers (including element names, classes, and IDs in selectors) … cannot start with a digit, two hyphens, or a hyphen followed by a digit.
This causes the error Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '#1-test' is not a valid selector.
if I try to do a document.querySelector()
on this selector. In tests, this seems to be caused by the leading digit.
The querySelector code is used, for example, in a recent Pull Request on the Docsy theme (google/docsy#506)
This format of anchor is produced with both Blackfriday and Goldmark as the markup generator and is independent of the setting of autoHeadingIDType
.