Pass RenderingContext by reference in Mmark

This commit is contained in:
bep 2015-05-25 12:57:37 +02:00
parent befb54da46
commit be79c35bda

View file

@ -208,7 +208,7 @@ func GetMmarkHtmlRenderer(defaultFlags int, ctx *RenderingContext) mmark.Rendere
return mmark.HtmlRendererWithParameters(htmlFlags, "", "", renderParameters) return mmark.HtmlRendererWithParameters(htmlFlags, "", "", renderParameters)
} }
func GetMmarkExtensions(ctx RenderingContext) int { func GetMmarkExtensions(ctx *RenderingContext) int {
flags := 0 flags := 0
flags |= mmark.EXTENSION_TABLES flags |= mmark.EXTENSION_TABLES
flags |= mmark.EXTENSION_FENCED_CODE flags |= mmark.EXTENSION_FENCED_CODE
@ -234,13 +234,13 @@ func GetMmarkExtensions(ctx RenderingContext) int {
func MmarkRender(ctx *RenderingContext) []byte { func MmarkRender(ctx *RenderingContext) []byte {
return mmark.Parse(ctx.Content, GetMmarkHtmlRenderer(0, ctx), return mmark.Parse(ctx.Content, GetMmarkHtmlRenderer(0, ctx),
GetMmarkExtensions(*ctx)).Bytes() GetMmarkExtensions(ctx)).Bytes()
} }
func MmarkRenderWithTOC(ctx *RenderingContext) []byte { func MmarkRenderWithTOC(ctx *RenderingContext) []byte {
return mmark.Parse(ctx.Content, return mmark.Parse(ctx.Content,
GetMmarkHtmlRenderer(0, ctx), GetMmarkHtmlRenderer(0, ctx),
GetMmarkExtensions(*ctx)).Bytes() GetMmarkExtensions(ctx)).Bytes()
} }
// ExtractTOC extracts Table of Contents from content. // ExtractTOC extracts Table of Contents from content.