markup/goldmark: Add an optional Blackfriday auto ID strategy

Fixes #6707
This commit is contained in:
Bjørn Erik Pedersen
2020-01-05 11:52:00 +01:00
parent 8f071fc159
commit 16e7c11203
7 changed files with 141 additions and 34 deletions

View File

@@ -178,6 +178,21 @@ func TestConvertAutoIDAsciiOnly(t *testing.T) {
c.Assert(got, qt.Contains, "<h2 id=\"god-is-good-\">")
}
func TestConvertAutoIDBlackfriday(t *testing.T) {
c := qt.New(t)
content := `
## Let's try this, shall we?
`
mconf := markup_config.Default
mconf.Goldmark.Parser.AutoHeadingIDType = goldmark_config.AutoHeadingIDTypeBlackfriday
b := convert(c, mconf, content)
got := string(b.Bytes())
c.Assert(got, qt.Contains, "<h2 id=\"let-s-try-this-shall-we\">")
}
func TestCodeFence(t *testing.T) {
c := qt.New(t)