From 0f8dc47037f59156c04540d97ed1b588e6bc1164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 28 May 2022 11:01:47 +0200 Subject: 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 --- hugolib/page_test.go | 104 ++------------------------------------------------- 1 file changed, 3 insertions(+), 101 deletions(-) (limited to 'hugolib/page_test.go') diff --git a/hugolib/page_test.go b/hugolib/page_test.go index e5f8840a6..1d9e3e348 100644 --- a/hugolib/page_test.go +++ b/hugolib/page_test.go @@ -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, "

first line.
\nsecond line.

\n\n

fourth line.

\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+`

Hugo

`) - b.WithContent("noblackfridayforyou.html", frontmatter+`**Hugo!**`) + b.WithContent("nomarkdownforyou.html", frontmatter+`**Hugo!**`) b.WithContent("manualsummary.html", frontmatter+`

This is summary

@@ -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", - `
SHORT
`, - `
MARKDOWN`,
-	)
-
-	b.AssertFileContent("public/page2/index.html",
-		`
SHORT`,
-	)
-}
-
 func TestPageCaseIssues(t *testing.T) {
 	t.Parallel()
 
-- 
cgit v1.2.3