"unicode/utf8"
"github.com/gohugoio/hugo/common/maps"
+ "github.com/gohugoio/hugo/hugolib/filesystems"
"github.com/niklasfasching/go-org/org"
bp "github.com/gohugoio/hugo/bufferpool"
"github.com/miekg/mmark"
"github.com/mitchellh/mapstructure"
"github.com/russross/blackfriday"
+ "github.com/spf13/afero"
jww "github.com/spf13/jwalterweatherman"
"strings"
// for a given content rendering.
// By creating you must set the Config, otherwise it will panic.
type RenderingContext struct {
+ BaseFs *filesystems.BaseFs
Content []byte
PageFmt string
DocumentID string
func orgRender(ctx *RenderingContext, c ContentSpec) []byte {
config := org.New()
config.Log = jww.WARN
+ config.ReadFile = func(filename string) ([]byte, error) {
+ return afero.ReadFile(ctx.BaseFs.Content.Fs, filename)
+ }
writer := org.NewHTMLWriter()
writer.HighlightCodeBlock = func(source, lang string) string {
highlightedSource, err := c.Highlight(source, lang, "")
html := cp.p.s.ContentSpec.RenderBytes(&helpers.RenderingContext{
Content: []byte(cp.p.m.summary), RenderTOC: false, PageFmt: cp.p.m.markup,
Cfg: p.Language(),
+ BaseFs: p.s.BaseFs,
DocumentID: p.File().UniqueID(), DocumentName: p.File().Path(),
Config: cp.p.getRenderingConfig()})
html = cp.p.s.ContentSpec.TrimShortHTML(html)
return cp.p.s.ContentSpec.RenderBytes(&helpers.RenderingContext{
Content: content, RenderTOC: true, PageFmt: cp.p.m.markup,
Cfg: p.Language(),
+ BaseFs: cp.p.s.BaseFs,
DocumentID: p.File().UniqueID(), DocumentName: p.File().Path(),
Config: cp.p.getRenderingConfig()})
}