Add Goldmark as the new default markdown handler

This commit adds the fast and CommonMark compliant Goldmark as the new default markdown handler in Hugo.

If you want to continue using BlackFriday as the default for md/markdown extensions, you can use this configuration:

```toml
[markup]
defaultMarkdownHandler="blackfriday"
```

Fixes #5963
Fixes #1778
Fixes #6355
This commit is contained in:
Bjørn Erik Pedersen
2019-11-06 20:10:47 +01:00
parent a3fe5e5e35
commit bfb9613a14
69 changed files with 3424 additions and 1668 deletions

View File

@@ -671,7 +671,7 @@ END
b.CreateSites().Build(BuildCfg{})
contentMatchers := []string{"<h2 id=\"another-header\">Another header</h2>", "<h2 id=\"another-header-99\">Another header</h2>", "<p>The End.</p>"}
contentMatchers := []string{"<h2 id=\"another-header\">Another header</h2>", "<h2 id=\"another-header99\">Another header</h2>", "<p>The End.</p>"}
for i := 1; i <= numPages; i++ {
if i%3 != 0 {
@@ -691,13 +691,13 @@ END
checkContent(b, fmt.Sprintf("public/%s/page%d/index.json", section, i), contentMatchers...)
}
checkContent(b, "public/s1/index.html", "P: s1/_index.md\nList: 10|List Content: 8335\n\n\nL1: 500 L2: 5\n\nRender 0: View: 8335\n\nRender 1: View: 8335\n\nRender 2: View: 8335\n\nRender 3: View: 8335\n\nRender 4: View: 8335\n\nEND\n")
checkContent(b, "public/s2/index.html", "P: s2/_index.md\nList: 10|List Content: 8335", "Render 4: View: 8335\n\nEND")
checkContent(b, "public/index.html", "P: _index.md\nList: 10|List Content: 8335", "4: View: 8335\n\nEND")
checkContent(b, "public/s1/index.html", "P: s1/_index.md\nList: 10|List Content: 8033\n\n\nL1: 500 L2: 5\n\nRender 0: View: 8033\n\nRender 1: View: 8033\n\nRender 2: View: 8033\n\nRender 3: View: 8033\n\nRender 4: View: 8033\n\nEND\n")
checkContent(b, "public/s2/index.html", "P: s2/_index.md\nList: 10|List Content: 8033", "Render 4: View: 8033\n\nEND")
checkContent(b, "public/index.html", "P: _index.md\nList: 10|List Content: 8033", "4: View: 8033\n\nEND")
// Check paginated pages
for i := 2; i <= 9; i++ {
checkContent(b, fmt.Sprintf("public/page/%d/index.html", i), fmt.Sprintf("Page: %d", i), "Content: 8335\n\n\nL1: 500 L2: 5\n\nRender 0: View: 8335", "Render 4: View: 8335\n\nEND")
checkContent(b, fmt.Sprintf("public/page/%d/index.html", i), fmt.Sprintf("Page: %d", i), "Content: 8033\n\n\nL1: 500 L2: 5\n\nRender 0: View: 8033", "Render 4: View: 8033\n\nEND")
}
}
@@ -977,7 +977,10 @@ enableRobotsTXT = true
[permalinks]
other = "/somewhere/else/:filename"
[blackfriday]
# TODO(bep)
[markup]
defaultMarkdownHandler = "blackfriday"
[markup.blackfriday]
angledQuotes = true
[Taxonomies]
@@ -1035,7 +1038,10 @@ enableRobotsTXT: true
permalinks:
other: "/somewhere/else/:filename"
blackfriday:
# TODO(bep)
markup:
defaultMarkdownHandler: blackfriday
blackFriday:
angledQuotes: true
Taxonomies:
@@ -1093,9 +1099,12 @@ var multiSiteJSONConfigTemplate = `
"permalinks": {
"other": "/somewhere/else/:filename"
},
"blackfriday": {
"angledQuotes": true
},
"markup": {
"defaultMarkdownHandler": "blackfriday",
"blackfriday": {
"angledQuotes": true
}
},
"Taxonomies": {
"tag": "tags"
},