mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-23 21:53:09 +02:00
Prepare for Goldmark
This commmit prepares for the addition of Goldmark as the new Markdown renderer in Hugo. This introduces a new `markup` package with some common interfaces and each implementation in its own package. See #5963
This commit is contained in:
@@ -97,19 +97,16 @@ func (ns *Namespace) Markdownify(s interface{}) (template.HTML, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
m := ns.deps.ContentSpec.RenderBytes(
|
||||
&helpers.RenderingContext{
|
||||
Cfg: ns.deps.Cfg,
|
||||
Content: []byte(ss),
|
||||
PageFmt: "markdown",
|
||||
Config: ns.deps.ContentSpec.BlackFriday,
|
||||
},
|
||||
)
|
||||
b, err := ns.deps.ContentSpec.RenderMarkdown([]byte(ss))
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Strip if this is a short inline type of text.
|
||||
m = ns.deps.ContentSpec.TrimShortHTML(m)
|
||||
b = ns.deps.ContentSpec.TrimShortHTML(b)
|
||||
|
||||
return helpers.BytesToHTML(m), nil
|
||||
return helpers.BytesToHTML(b), nil
|
||||
}
|
||||
|
||||
// Plainify returns a copy of s with all HTML tags removed.
|
||||
|
Reference in New Issue
Block a user