Closed mowies closed 7 months ago
Python Markdown has been like this for a long, long time. Making a change to not collapse -
into a single instance of -
would not be backward compatible and would likely break many user's expectations.
With that said Python Markdown provides a way where you can override the slug behavior if you so choose. You can simply craft your own slugify method and use the slugify option to specify it.
Python Markdown has been like this for a long, long time.
This was my thought as well. In fact, it is very likely that we implemented our behavior first and other implementations added their behavior later. They failed to follow our lead. In fact, I would argue that our behavior (collapsing multiple consecutive hyphens into 1) is the correct behavior and implementations which do not do that should be changed.
Regardless, we now have many thousands of existing documents which have many thousands of links pointing to them using thee existing format. A change in behavior would break many of the existing links. Therefore, we will not be making a change to the default behavior.
During a switch of static site generator tools in Keptn from Hugo to MkDocs we noticed that python-markdown (with
toc
extension) renders certain IDs for headings differently compared to other renderers. Take not of the double--
and single-
in the below examples:Input
Output of Goldmark
Output of Python-Markdown (with toc extension)
As you can see, the
-s
of the heading is rendered with either one or two-
in the HTML ID. Also GitHub uses the version with double-
, as you can see in this minimal example I created.Minimal examples of the Go and Python tests above can be found in the above GitHub Gist as well. Python: link Go: link