mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +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:
@@ -21,6 +21,8 @@ import (
|
||||
"html/template"
|
||||
"path"
|
||||
|
||||
"github.com/gohugoio/hugo/markup/converter"
|
||||
|
||||
"github.com/gohugoio/hugo/common/herrors"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
@@ -43,7 +45,6 @@ import (
|
||||
"github.com/gohugoio/hugo/output"
|
||||
|
||||
bp "github.com/gohugoio/hugo/bufferpool"
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
"github.com/gohugoio/hugo/tpl"
|
||||
)
|
||||
|
||||
@@ -347,13 +348,19 @@ func renderShortcode(
|
||||
// Pre Hugo 0.55 this was the behaviour even for the outer-most
|
||||
// shortcode.
|
||||
if sc.doMarkup && (level > 0 || sc.info.Config.Version == 1) {
|
||||
newInner := s.ContentSpec.RenderBytes(&helpers.RenderingContext{
|
||||
Content: []byte(inner),
|
||||
PageFmt: p.m.markup,
|
||||
Cfg: p.Language(),
|
||||
DocumentID: p.File().UniqueID(),
|
||||
DocumentName: p.File().Path(),
|
||||
Config: p.getRenderingConfig()})
|
||||
var err error
|
||||
|
||||
b, err := p.getContentConverter().Convert(
|
||||
converter.RenderContext{
|
||||
Src: []byte(inner),
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return "", false, err
|
||||
}
|
||||
|
||||
newInner := b.Bytes()
|
||||
|
||||
// If the type is “” (unknown) or “markdown”, we assume the markdown
|
||||
// generation has been performed. Given the input: `a line`, markdown
|
||||
|
Reference in New Issue
Block a user