Improve compatibility with some Markdown renderers

Some Markdown flavors (e.g. GitLab Favored Markdown) convert headers
to URLs replacing all characters which are not Latin and numeric
with "-". This change improves the compatibility with them.

Note: this conflicts partially with 1fa9be4 though