Remove Blackfriday markdown engine

It has been deprecated for a long time, its v1 version is not maintained anymore, and there are many known issues. Goldmark should be
a mature replacement by now.

Closes #9934
This commit is contained in:
Bjørn Erik Pedersen
2022-05-28 11:01:47 +02:00
parent 3b478f50b7
commit 0f8dc47037
22 changed files with 71 additions and 1675 deletions

View File

@@ -238,16 +238,6 @@ the cylinder and strike me down. ## BB
### BBB
"You're a great Granser," he cried delightedly, "always making believe them little marks mean something."
`
simplePageWithAdditionalExtension = `+++
[blackfriday]
extensions = ["hardLineBreak"]
+++
first line.
second line.
fourth line.
`
simplePageWithURL = `---
@@ -694,26 +684,6 @@ func TestPageWithShortCodeInSummary(t *testing.T) {
testAllMarkdownEnginesForPages(t, assertFunc, nil, simplePageWithShortcodeInSummary)
}
func TestPageWithAdditionalExtension(t *testing.T) {
t.Parallel()
cfg, fs := newTestCfg()
cfg.Set("markup", map[string]any{
"defaultMarkdownHandler": "blackfriday", // TODO(bep)
})
c := qt.New(t)
writeSource(t, fs, filepath.Join("content", "simple.md"), simplePageWithAdditionalExtension)
s := buildSingleSite(t, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{SkipRender: true})
c.Assert(len(s.RegularPages()), qt.Equals, 1)
p := s.RegularPages()[0]
checkPageContent(t, p, "<p>first line.<br />\nsecond line.</p>\n\n<p>fourth line.</p>\n")
}
func TestTableOfContents(t *testing.T) {
cfg, fs := newTestCfg()
c := qt.New(t)
@@ -1373,7 +1343,7 @@ title: "HTML Content"
---
`
b.WithContent("regular.html", frontmatter+`<h1>Hugo</h1>`)
b.WithContent("noblackfridayforyou.html", frontmatter+`**Hugo!**`)
b.WithContent("nomarkdownforyou.html", frontmatter+`**Hugo!**`)
b.WithContent("manualsummary.html", frontmatter+`
<p>This is summary</p>
<!--more-->
@@ -1387,8 +1357,8 @@ title: "HTML Content"
"Summary: Hugo|Truncated: false")
b.AssertFileContent(
"public/noblackfridayforyou/index.html",
"Permalink: http://example.com/noblackfridayforyou/|**Hugo!**|",
"public/nomarkdownforyou/index.html",
"Permalink: http://example.com/nomarkdownforyou/|**Hugo!**|",
)
// https://github.com/gohugoio/hugo/issues/5723
@@ -2011,74 +1981,6 @@ Link with URL as text
`)
}
func TestBlackfridayDefault(t *testing.T) {
t.Parallel()
b := newTestSitesBuilder(t).WithConfigFile("toml", `
baseURL = "https://example.org"
[markup]
defaultMarkdownHandler="blackfriday"
[markup.highlight]
noClasses=false
[markup.goldmark]
[markup.goldmark.renderer]
unsafe=true
`)
// Use the new attribute syntax to make sure it's not Goldmark.
b.WithTemplatesAdded("_default/single.html", `
Title: {{ .Title }}
Content: {{ .Content }}
`, "shortcodes/s.html", `## Code
{{ .Inner }}
`)
content := `
+++
title = "A Page!"
+++
## Code Fense in Shortcode
{{% s %}}
S:
{{% s %}}
$$$bash {hl_lines=[1]}
SHORT
$$$
{{% /s %}}
{{% /s %}}
## Code Fence
$$$bash {hl_lines=[1]}
MARKDOWN
$$$
`
content = strings.ReplaceAll(content, "$$$", "```")
for i, ext := range []string{"md", "html"} {
b.WithContent(fmt.Sprintf("page%d.%s", i+1, ext), content)
}
b.Build(BuildCfg{})
// Blackfriday does not support this extended attribute syntax.
b.AssertFileContent("public/page1/index.html",
`<pre tabindex="0"><code class="language-bash {hl_lines=[1]}" data-lang="bash {hl_lines=[1]}">SHORT</code></pre>`,
`<pre tabindex="0"><code class="language-bash {hl_lines=[1]}" data-lang="bash {hl_lines=[1]}">MARKDOWN`,
)
b.AssertFileContent("public/page2/index.html",
`<pre tabindex="0"><code class="language-bash {hl_lines=[1]}" data-lang="bash {hl_lines=[1]}">SHORT`,
)
}
func TestPageCaseIssues(t *testing.T) {
t.Parallel()