Skip to content

Commit 0f8dc47

Browse files
committed
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 gohugoio#9934
1 parent 3b478f5 commit 0f8dc47

22 files changed

+71
-1675
lines changed

hugolib/case_insensitive_test.go

-231
This file was deleted.

hugolib/config.go

-5
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,6 @@ func LoadConfig(d ConfigSourceDescriptor, doWithConfig ...func(cfg config.Provid
108108
}
109109
}
110110

111-
// Config deprecations.
112-
if l.cfg.GetString("markup.defaultMarkdownHandler") == "blackfriday" {
113-
helpers.Deprecated("markup.defaultMarkdownHandler=blackfriday", "See https://gohugo.io//content-management/formats/#list-of-content-formats", false)
114-
}
115-
116111
// Some settings are used before we're done collecting all settings,
117112
// so apply OS environment both before and after.
118113
if err := l.applyOsEnvOverrides(d.Environ); err != nil {

hugolib/hugo_sites_build_test.go

-63
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,6 @@ func doTestMultiSitesBuild(t *testing.T, configTemplate, configSuffix string) {
365365
c.Assert(frTags["FRtag1"], qt.Not(qt.IsNil))
366366
b.AssertFileContent("public/fr/plaques/FRtag1/index.html", "FRtag1|Bonjour|http://example.com/blog/fr/plaques/FRtag1/")
367367

368-
// Check Blackfriday config
369-
c.Assert(strings.Contains(content(doc1fr), "«"), qt.Equals, true)
370-
c.Assert(strings.Contains(content(doc1en), "«"), qt.Equals, false)
371-
c.Assert(strings.Contains(content(doc1en), "“"), qt.Equals, true)
372-
373368
// en and nn have custom site menus
374369
c.Assert(len(frSite.Menus()), qt.Equals, 0)
375370
c.Assert(len(enSite.Menus()), qt.Equals, 1)
@@ -796,39 +791,6 @@ categories: ["mycat"]
796791
}
797792
}
798793

799-
// https://github.com/gohugoio/hugo/issues/5777
800-
func TestTableOfContentsInShortcodes(t *testing.T) {
801-
t.Parallel()
802-
803-
b := newMultiSiteTestDefaultBuilder(t)
804-
805-
b.WithTemplatesAdded("layouts/shortcodes/toc.html", tocShortcode)
806-
b.WithTemplatesAdded("layouts/shortcodes/wrapper.html", "{{ .Inner }}")
807-
b.WithContent("post/simple.en.md", tocPageSimple)
808-
b.WithContent("post/variants1.en.md", tocPageVariants1)
809-
b.WithContent("post/variants2.en.md", tocPageVariants2)
810-
811-
b.WithContent("post/withSCInHeading.en.md", tocPageWithShortcodesInHeadings)
812-
813-
b.CreateSites().Build(BuildCfg{})
814-
815-
b.AssertFileContent("public/en/post/simple/index.html",
816-
tocPageSimpleExpected,
817-
// Make sure it is inserted twice
818-
`TOC1: <nav id="TableOfContents">`,
819-
`TOC2: <nav id="TableOfContents">`,
820-
)
821-
822-
b.AssertFileContentFn("public/en/post/variants1/index.html", func(s string) bool {
823-
return strings.Count(s, "TableOfContents") == 4
824-
})
825-
b.AssertFileContentFn("public/en/post/variants2/index.html", func(s string) bool {
826-
return strings.Count(s, "TableOfContents") == 6
827-
})
828-
829-
b.AssertFileContent("public/en/post/withSCInHeading/index.html", tocPageWithShortcodesInHeadingsExpected)
830-
}
831-
832794
var tocShortcode = `
833795
TOC1: {{ .Page.TableOfContents }}
834796
@@ -970,12 +932,6 @@ enableRobotsTXT = true
970932
[permalinks]
971933
other = "/somewhere/else/:filename"
972934
973-
# TODO(bep)
974-
[markup]
975-
defaultMarkdownHandler = "blackfriday"
976-
[markup.blackfriday]
977-
angledQuotes = true
978-
979935
[Taxonomies]
980936
tag = "tags"
981937
@@ -984,8 +940,6 @@ tag = "tags"
984940
weight = 10
985941
title = "In English"
986942
languageName = "English"
987-
[Languages.en.blackfriday]
988-
angledQuotes = false
989943
[[Languages.en.menu.main]]
990944
url = "/"
991945
name = "Home"
@@ -1031,12 +985,6 @@ enableRobotsTXT: true
1031985
permalinks:
1032986
other: "/somewhere/else/:filename"
1033987
1034-
# TODO(bep)
1035-
markup:
1036-
defaultMarkdownHandler: blackfriday
1037-
blackFriday:
1038-
angledQuotes: true
1039-
1040988
Taxonomies:
1041989
tag: "tags"
1042990
@@ -1045,8 +993,6 @@ Languages:
1045993
weight: 10
1046994
title: "In English"
1047995
languageName: "English"
1048-
blackfriday:
1049-
angledQuotes: false
1050996
menu:
1051997
main:
1052998
- url: "/"
@@ -1092,12 +1038,6 @@ var multiSiteJSONConfigTemplate = `
10921038
"permalinks": {
10931039
"other": "/somewhere/else/:filename"
10941040
},
1095-
"markup": {
1096-
"defaultMarkdownHandler": "blackfriday",
1097-
"blackfriday": {
1098-
"angledQuotes": true
1099-
}
1100-
},
11011041
"Taxonomies": {
11021042
"tag": "tags"
11031043
},
@@ -1106,9 +1046,6 @@ var multiSiteJSONConfigTemplate = `
11061046
"weight": 10,
11071047
"title": "In English",
11081048
"languageName": "English",
1109-
"blackfriday": {
1110-
"angledQuotes": false
1111-
},
11121049
"menu": {
11131050
"main": [
11141051
{

hugolib/page.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ func (p *pageState) getContentConverter() converter.Converter {
600600
// Only used for shortcode inner content.
601601
markup = "markdown"
602602
}
603-
p.m.contentConverter, err = p.m.newContentConverter(p, markup, p.m.renderingConfigOverrides)
603+
p.m.contentConverter, err = p.m.newContentConverter(p, markup)
604604
})
605605

606606
if err != nil {
@@ -698,7 +698,7 @@ Loop:
698698
p.source.hasSummaryDivider = true
699699

700700
if meta.markup != "html" {
701-
// The content will be rendered by Blackfriday or similar,
701+
// The content will be rendered by Goldmark or similar,
702702
// and we need to track the summary.
703703
rn.AddReplacement(internalSummaryDividerPre, it)
704704
}

hugolib/page__content.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type pageContent struct {
3838
source rawPageContent
3939
}
4040

41-
// returns the content to be processed by Blackfriday or similar.
41+
// returns the content to be processed by Goldmark or similar.
4242
func (p pageContent) contentToRender(renderedShortcodes map[string]string) []byte {
4343
source := p.source.parsed.Input()
4444

0 commit comments

Comments
 (0)