Heading anchors and punctuation

I’m having issues with anchors that point to headers, like table of contents links that let you jump to sections on the page.
For example, I used the web clipper to clip the complete page of https://excelmacromastery.com/excel-vba-sub/
The first header in HTML:

<h1><span id="Quick_Guide_to_the_VBA_Sub">Quick Guide to the VBA Sub</span></h1>

in markdown becomes:

# Quick Guide to the VBA Sub

The link in the table of contents in HTML:

<a href="#Quick_Guide_to_the_VBA_Sub"><span class="toc_number toc_depth_1">1</span> Quick Guide to the VBA Sub</a>

in markdown becomes:

* [1 Quick Guide to the VBA Sub](#Quick_Guide_to_the_VBA_Sub)

This doesn’t work because according to this, the code that creates anchor:

  1. It downcases the string
  2. remove anything that is not a letter, number, space or hyphen (see the source for how Unicode is handled)
  3. changes any space to a hyphen.
  4. If that is not unique, add “-1”, “-2”, “-3”,… to make it unique

Which means it should look like:

* [1 Quick Guide to the VBA Sub](#quick-guide-to-the-vba-sub)

If I change it to that the link works and when I click on it it will jump to the section of the document with that header. The problem is with this header:

<h1><span id="What_is_a_Sub">What is a Sub?</span></h1>

and TOC link:

<a href="#What_is_a_Sub"><span class="toc_number toc_depth_1">3</span> What is a Sub?</a>

In markdown:

# What is a Sub?


* [3 What is a Sub?](#What_is_a_Sub)

This is what the TOC link should look like:

* [3 What is a Sub?](#what-is-a-sub)

But unlike the first link, this one doesn’t work. The only difference is the question mark at the end of the header.

So am I doing it wrong or is this a bug?