markup/goldmark: Make auto IDs GitHub compatible

You can turn off this behaviour:

```toml
[markup]
  [markup.goldmark]
    [markup.goldmark.parser]
      autoHeadingIDAsciiOnly = true
```
Note that the `anchorize` now adapts its behaviour depending on the default Markdown handler.

Fixes #6616
This commit is contained in:
Bjørn Erik Pedersen
2020-01-04 11:28:19 +01:00
parent ae816452b1
commit a82d2700fc
12 changed files with 421 additions and 35 deletions

View File

@@ -25,7 +25,6 @@ import (
"github.com/gohugoio/hugo/common/urls"
"github.com/gohugoio/hugo/deps"
_errors "github.com/pkg/errors"
"github.com/russross/blackfriday"
"github.com/spf13/cast"
)
@@ -90,7 +89,7 @@ func (ns *Namespace) Anchorize(a interface{}) (string, error) {
if err != nil {
return "", nil
}
return blackfriday.SanitizedAnchorName(s), nil
return ns.deps.ContentSpec.SanitizeAnchorName(s), nil
}
// Ref returns the absolute URL path to a given content item.