Trim excess dashes from heading IDs

When I have something like

~~~
# Heading with some trailing punctuation...
~~~

With the default Renderer I get

~~~html
<h1 id="heading-with-some-trailing-punctuation-">Heading with some trailing punctuation...</h1>
~~~

(notice the trailing dash in the id).
This PR fixes this:

~~~html
<h1 id="heading-with-some-trailing-punctuation">Heading with some trailing punctuation...</h1>
~~~

**Warning**: this may change the way URLs are generated and break existing links.