mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-25 22:00:58 +02:00
Apply project wide go fmt
This commit is contained in:
@@ -4,9 +4,9 @@ import (
|
||||
"bytes"
|
||||
"html"
|
||||
|
||||
"github.com/miekg/mmark"
|
||||
"github.com/russross/blackfriday"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/miekg/mmark"
|
||||
)
|
||||
|
||||
// Wraps a blackfriday.Renderer, typically a blackfriday.Html
|
||||
|
@@ -1,14 +1,15 @@
|
||||
package helpers
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"github.com/spf13/viper"
|
||||
"bytes"
|
||||
"github.com/spf13/viper"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Renders a codeblock using Blackfriday
|
||||
func render(input string) string {
|
||||
ctx := &RenderingContext{};
|
||||
render := GetHTMLRenderer(0, ctx);
|
||||
ctx := &RenderingContext{}
|
||||
render := GetHTMLRenderer(0, ctx)
|
||||
|
||||
buf := &bytes.Buffer{}
|
||||
render.BlockCode(buf, []byte(input), "html")
|
||||
@@ -17,15 +18,14 @@ func render(input string) string {
|
||||
|
||||
// Renders a codeblock using Mmark
|
||||
func renderWithMmark(input string) string {
|
||||
ctx := &RenderingContext{};
|
||||
render := GetMmarkHtmlRenderer(0, ctx);
|
||||
ctx := &RenderingContext{}
|
||||
render := GetMmarkHtmlRenderer(0, ctx)
|
||||
|
||||
buf := &bytes.Buffer{}
|
||||
render.BlockCode(buf, []byte(input), "html", []byte(""), false, false)
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
|
||||
func TestCodeFence(t *testing.T) {
|
||||
|
||||
if !HasPygments() {
|
||||
@@ -38,7 +38,7 @@ func TestCodeFence(t *testing.T) {
|
||||
input, expected string
|
||||
}
|
||||
data := []test{
|
||||
{true, "<html></html>", "<div class=\"highlight\"><pre><span class=\"nt\"><html></html></span>\n</pre></div>\n"},
|
||||
{true, "<html></html>", "<div class=\"highlight\"><pre><span class=\"nt\"><html></html></span>\n</pre></div>\n"},
|
||||
{false, "<html></html>", "<pre><code class=\"language-html\"><html></html></code></pre>\n"},
|
||||
}
|
||||
|
||||
|
@@ -98,7 +98,7 @@ func Highlight(code, lang, optsStr string) string {
|
||||
if lang == "" {
|
||||
langOpt = "-g" // Try guessing the language
|
||||
} else {
|
||||
langOpt = "-l"+lang
|
||||
langOpt = "-l" + lang
|
||||
}
|
||||
|
||||
cmd := exec.Command(pygmentsBin, langOpt, "-fhtml", "-O", options)
|
||||
|
Reference in New Issue
Block a user