Add source to variables when rendering to support reveal.js and slide decks or re-using the content source

This commit is contained in:
James Mills 2023-03-29 23:37:20 +10:00
parent ce6360eb75
commit c8c4ac861a
No known key found for this signature in database
GPG Key ID: AC4C014F1440EBD6

View File

@ -467,13 +467,14 @@ func buildMarkdown(path string, w io.Writer, vars Vars) error {
return err
}
content, err := render(body, v)
source, err := render(body, v)
if err != nil {
return err
}
v["source"] = source
buf := &bytes.Buffer{}
if err := Parser.Convert([]byte(content), buf); err != nil {
if err := Parser.Convert([]byte(source), buf); err != nil {
return err
}
v["content"] = buf.String()