mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +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:
@@ -23,6 +23,8 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/gohugoio/hugo/markup/converter"
|
||||
|
||||
"github.com/gohugoio/hugo/common/maps"
|
||||
|
||||
"github.com/gohugoio/hugo/hugofs/files"
|
||||
@@ -65,7 +67,7 @@ var (
|
||||
type pageContext interface {
|
||||
posOffset(offset int) text.Position
|
||||
wrapError(err error) error
|
||||
getRenderingConfig() *helpers.BlackFriday
|
||||
getContentConverter() converter.Converter
|
||||
}
|
||||
|
||||
// wrapErr adds some context to the given error if possible.
|
||||
@@ -299,13 +301,6 @@ func (p *pageState) Translations() page.Pages {
|
||||
return p.translations
|
||||
}
|
||||
|
||||
func (p *pageState) getRenderingConfig() *helpers.BlackFriday {
|
||||
if p.m.renderingConfig == nil {
|
||||
return p.s.ContentSpec.BlackFriday
|
||||
}
|
||||
return p.m.renderingConfig
|
||||
}
|
||||
|
||||
func (ps *pageState) initCommonProviders(pp pagePaths) error {
|
||||
if ps.IsPage() {
|
||||
ps.posNextPrev = &nextPrev{init: ps.s.init.prevNext}
|
||||
@@ -516,6 +511,10 @@ func (p *pageState) wrapError(err error) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *pageState) getContentConverter() converter.Converter {
|
||||
return p.m.contentConverter
|
||||
}
|
||||
|
||||
func (p *pageState) addResources(r ...resource.Resource) {
|
||||
p.resources = append(p.resources, r...)
|
||||
}
|
||||
|
Reference in New Issue
Block a user