diff --git a/filters/filters.go b/filters/filters.go index bd63cd7..e286152 100644 --- a/filters/filters.go +++ b/filters/filters.go @@ -87,7 +87,7 @@ func AddJekyllFilters(e *liquid.Engine, c *config.Config) { return c.BaseURL + s }) e.RegisterFilter("jsonify", json.Marshal) - e.RegisterFilter("markdownify", blackfriday.MarkdownCommon) + e.RegisterFilter("markdownify", blackfriday.Run) e.RegisterFilter("normalize_whitespace", func(s string) string { // s = strings.Replace(s, "n", "N", -1) wsPattern := regexp.MustCompile(`(?s:[\s\n]+)`) diff --git a/renderers/markdown.go b/renderers/markdown.go index b4216a9..031263e 100644 --- a/renderers/markdown.go +++ b/renderers/markdown.go @@ -11,31 +11,34 @@ import ( ) const blackfridayFlags = 0 | - blackfriday.HTML_USE_XHTML | - blackfriday.HTML_USE_SMARTYPANTS | - blackfriday.HTML_SMARTYPANTS_FRACTIONS | - blackfriday.HTML_SMARTYPANTS_DASHES | - blackfriday.HTML_SMARTYPANTS_LATEX_DASHES + blackfriday.UseXHTML | + blackfriday.Smartypants | + blackfriday.SmartypantsFractions | + blackfriday.SmartypantsDashes | + blackfriday.SmartypantsLatexDashes const blackfridayExtensions = 0 | - blackfriday.EXTENSION_NO_INTRA_EMPHASIS | - blackfriday.EXTENSION_TABLES | - blackfriday.EXTENSION_FENCED_CODE | - blackfriday.EXTENSION_AUTOLINK | - blackfriday.EXTENSION_STRIKETHROUGH | - blackfriday.EXTENSION_SPACE_HEADERS | - blackfriday.EXTENSION_HEADER_IDS | - blackfriday.EXTENSION_BACKSLASH_LINE_BREAK | - blackfriday.EXTENSION_DEFINITION_LISTS | + blackfriday.NoIntraEmphasis | + blackfriday.Tables | + blackfriday.FencedCode | + blackfriday.Autolink | + blackfriday.Strikethrough | + blackfriday.SpaceHeadings | + blackfriday.HeadingIDs | + blackfriday.BackslashLineBreak | + blackfriday.DefinitionLists | // added relative to commonExtensions - blackfriday.EXTENSION_AUTO_HEADER_IDS + blackfriday.AutoHeadingIDs func renderMarkdown(md []byte) ([]byte, error) { - renderer := blackfriday.HtmlRenderer(blackfridayFlags, "", "") - html := blackfriday.MarkdownOptions( + params := blackfriday.HTMLRendererParameters{ + Flags: blackfridayFlags, + } + renderer := blackfriday.NewHTMLRenderer(params) + html := blackfriday.Run( md, - renderer, - blackfriday.Options{Extensions: blackfridayExtensions}, + blackfriday.WithRenderer(renderer), + blackfriday.WithExtensions(blackfridayExtensions), ) html, err := renderInnerMarkdown(html) if err != nil { @@ -45,11 +48,14 @@ func renderMarkdown(md []byte) ([]byte, error) { } func _renderMarkdown(md []byte) ([]byte, error) { - renderer := blackfriday.HtmlRenderer(blackfridayFlags, "", "") - html := blackfriday.MarkdownOptions( + params := blackfriday.HTMLRendererParameters{ + Flags: blackfridayFlags, + } + renderer := blackfriday.NewHTMLRenderer(params) + html := blackfriday.Run( md, - renderer, - blackfriday.Options{Extensions: blackfridayExtensions}, + blackfriday.WithRenderer(renderer), + blackfriday.WithExtensions(blackfridayExtensions), ) return html, nil }