I've been using your markdown-styles page generator and noticed that some entries in table of contents doesn't work. I inspected them and found out that if a heading text contains punctuation symbols, including reserved URL characters, they will also be included (confirmed by this part of the code). This breaks the link to what the Markdown converter generated where most of them are simply removed.
Heading text: !"#$%&'()*+,-./0123456789:;<=>?@[\]^_`{|}~
Expected: -0123456789_
Result: !"#$%&'()*+,-./0123456789:;<=>?@[\]^_`{|}~
Adding this right below the line I mentioned resolves this issue:
id = id.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\]^`{|}~]/g, '');