getMarkdownExtensions(ctx))
}
-// getMmarkHtmlRenderer returns markdown html renderer.
-func getMmarkHtmlRenderer(defaultFlags int, ctx *RenderingContext) mmark.Renderer {
+// getMmarkHTMLRenderer creates a new mmark HTML Renderer with the given configuration.
+func getMmarkHTMLRenderer(defaultFlags int, ctx *RenderingContext) mmark.Renderer {
renderParameters := mmark.HtmlRendererParameters{
FootnoteAnchorPrefix: viper.GetString("FootnoteAnchorPrefix"),
FootnoteReturnLinkContents: viper.GetString("FootnoteReturnLinkContents"),
}
}
-// getMmarkExtensions returns markdown extensions.
func getMmarkExtensions(ctx *RenderingContext) int {
flags := 0
flags |= mmark.EXTENSION_TABLES
return flags
}
-// mmarkRender renders markdowns.
func mmarkRender(ctx *RenderingContext) []byte {
- return mmark.Parse(ctx.Content, getMmarkHtmlRenderer(0, ctx),
+ return mmark.Parse(ctx.Content, getMmarkHTMLRenderer(0, ctx),
getMmarkExtensions(ctx)).Bytes()
}
import (
"bytes"
- "github.com/spf13/viper"
"regexp"
"testing"
+
+ "github.com/spf13/viper"
)
// Renders a codeblock using Blackfriday
// Renders a codeblock using Mmark
func renderWithMmark(input string) string {
ctx := &RenderingContext{}
- render := getMmarkHtmlRenderer(0, ctx)
+ render := getMmarkHTMLRenderer(0, ctx)
buf := &bytes.Buffer{}
render.BlockCode(buf, []byte(input), "html", []byte(""), false, false)
}
}
-func TestGetMmarkHtmlRenderer(t *testing.T) {
+func TestGetMmarkHTMLRenderer(t *testing.T) {
ctx := &RenderingContext{}
ctx.DocumentID = "testid"
ctx.Config = ctx.getConfig()
ctx.Config.PlainIDAnchors = false
- actualRenderer := getMmarkHtmlRenderer(0, ctx)
+ actualRenderer := getMmarkHTMLRenderer(0, ctx)
headerBuffer := &bytes.Buffer{}
footnoteBuffer := &bytes.Buffer{}