summaryrefslogtreecommitdiffstats
path: root/helpers/content_renderer.go
diff options
context:
space:
mode:
authorJorin Vogel <hi@jorin.me>2017-08-02 14:25:05 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-08-03 15:57:51 +0200
commit81c13171a985b89f2af6682dbd1d4b8766cb9af7 (patch)
treedb39d78bbe6da0ea3f3dd3d2f94c7e1571ad8fd6 /helpers/content_renderer.go
parent9891c0fb0eb274b8a95b62c40070a87a6e04088c (diff)
Add some missing doc comments
As pointed out by the linter, some exported functions and types are missing doc comments. The linter warnings have been reduced from 194 to 116. Not all missing comments have been added in this commit though.
Diffstat (limited to 'helpers/content_renderer.go')
-rw-r--r--helpers/content_renderer.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/helpers/content_renderer.go b/helpers/content_renderer.go
index 10d99ec8e..5c7d854b6 100644
--- a/helpers/content_renderer.go
+++ b/helpers/content_renderer.go
@@ -22,7 +22,10 @@ import (
"github.com/russross/blackfriday"
)
+// LinkResolverFunc describes a custom function to resolve a given link.
type LinkResolverFunc func(ref string) (string, error)
+
+// FileResolverFunc describes a custom function to resolve a given file path.
type FileResolverFunc func(ref string) (string, error)
// HugoHTMLRenderer wraps a blackfriday.Renderer, typically a blackfriday.Html
@@ -32,6 +35,8 @@ type HugoHTMLRenderer struct {
blackfriday.Renderer
}
+// BlockCode renders a given text as a block of code.
+// Pygments is used if it is setup to handle code fences.
func (r *HugoHTMLRenderer) BlockCode(out *bytes.Buffer, text []byte, lang string) {
if r.Cfg.GetBool("pygmentsCodeFences") && (lang != "" || r.Cfg.GetBool("pygmentsCodeFencesGuessSyntax")) {
opts := r.Cfg.GetString("pygmentsOptions")
@@ -84,13 +89,15 @@ func (r *HugoHTMLRenderer) List(out *bytes.Buffer, text func() bool, flags int)
}
}
-// HugoMmarkHTMLRenderer wraps a mmark.Renderer, typically a mmark.html
-// Enabling Hugo to customise the rendering experience
+// HugoMmarkHTMLRenderer wraps a mmark.Renderer, typically a mmark.html,
+// enabling Hugo to customise the rendering experience.
type HugoMmarkHTMLRenderer struct {
mmark.Renderer
Cfg config.Provider
}
+// BlockCode renders a given text as a block of code.
+// Pygments is used if it is setup to handle code fences.
func (r *HugoMmarkHTMLRenderer) BlockCode(out *bytes.Buffer, text []byte, lang string, caption []byte, subfigure bool, callouts bool) {
if r.Cfg.GetBool("pygmentsCodeFences") && (lang != "" || r.Cfg.GetBool("pygmentsCodeFencesGuessSyntax")) {
str := html.UnescapeString(string(text))