diff options
author | Bjørn Erik Pedersen <[email protected]> | 2022-02-14 13:27:17 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2022-02-15 10:37:14 +0100 |
commit | ea54a99ca5c4ed9e66574553f6c057fb83d0aca3 (patch) | |
tree | 7d8b7db9e798635f8fe84df5ee56d3401e6dd966 /markup | |
parent | 9563c7d13b157612b01a9d108c134c407126b328 (diff) | |
download | hugo-ea54a99ca5c4ed9e66574553f6c057fb83d0aca3.tar.gz hugo-ea54a99ca5c4ed9e66574553f6c057fb83d0aca3.zip |
deps: Update github.com/alecthomas/chroma v0.9.4 => v0.10.0
Diffstat (limited to 'markup')
-rw-r--r-- | markup/goldmark/convert_test.go | 19 | ||||
-rw-r--r-- | markup/highlight/highlight_test.go | 8 |
2 files changed, 13 insertions, 14 deletions
diff --git a/markup/goldmark/convert_test.go b/markup/goldmark/convert_test.go index 5fe6997e8..684f22c54 100644 --- a/markup/goldmark/convert_test.go +++ b/markup/goldmark/convert_test.go @@ -154,7 +154,7 @@ description c.Assert(got, qt.Contains, `<h2 id="神真美好-2">神真美好</h2>`, qt.Commentf(got)) // Code fences - c.Assert(got, qt.Contains, "<div class=\"highlight\"><pre tabindex=\"0\" class=\"chroma\"><code class=\"language-bash\" data-lang=\"bash\">LINE1\n</code></pre></div>") + c.Assert(got, qt.Contains, "<div class=\"highlight\"><pre tabindex=\"0\" class=\"chroma\"><code class=\"language-bash\" data-lang=\"bash\"><span class=\"line\"><span class=\"cl\">LINE1\n</span></span></code></pre></div>") c.Assert(got, qt.Contains, "Code Fences No Lexer</h2>\n<pre tabindex=\"0\"><code class=\"language-moo\" data-lang=\"moo\">LINE1\n</code></pre>") // Extensions @@ -263,8 +263,10 @@ func TestConvertAttributes(t *testing.T) { conf.Highlight.CodeFences = true }, "```bash {linenos=table .myclass id=\"myid\"}\necho 'foo';\n````\n{ .adfadf }", - []string{"div class=\"highlight myclass\" id=\"myid\"><div s", - "table style"}, + []string{ + "div class=\"highlight myclass\" id=\"myid\"><div s", + "table style", + }, }, { "Paragraph", @@ -326,10 +328,8 @@ func TestConvertAttributes(t *testing.T) { for _, s := range cast.ToStringSlice(test.expect) { c.Assert(got, qt.Contains, s) } - }) } - } func TestConvertIssues(t *testing.T) { @@ -389,8 +389,7 @@ LINE5 result := convertForConfig(c, cfg, `echo "Hugo Rocks!"`, "bash") // TODO(bep) there is a whitespace mismatch (\n) between this and the highlight template func. - c.Assert(result, qt.Equals, `<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="nb">echo</span> <span class="s2">"Hugo Rocks!"</span> -</code></pre></div>`) + c.Assert(result, qt.Equals, "<div class=\"highlight\"><pre tabindex=\"0\" class=\"chroma\"><code class=\"language-bash\" data-lang=\"bash\"><span class=\"line\"><span class=\"cl\"><span class=\"nb\">echo</span> <span class=\"s2\">"Hugo Rocks!"</span>\n</span></span></code></pre></div>") result = convertForConfig(c, cfg, `echo "Hugo Rocks!"`, "unknown") c.Assert(result, qt.Equals, "<pre tabindex=\"0\"><code class=\"language-unknown\" data-lang=\"unknown\">echo "Hugo Rocks!"\n</code></pre>") }) @@ -404,7 +403,7 @@ LINE5 c.Assert(result, qt.Contains, "<span class=\"hl\"><span class=\"lnt\">4") result = convertForConfig(c, cfg, lines, "bash {linenos=inline,hl_lines=[2]}") - c.Assert(result, qt.Contains, "<span class=\"ln\">2</span>LINE2\n</span>") + c.Assert(result, qt.Contains, "<span class=\"ln\">2</span><span class=\"cl\">LINE2\n</span></span>") c.Assert(result, qt.Not(qt.Contains), "<table") result = convertForConfig(c, cfg, lines, "bash {linenos=true,hl_lines=[2]}") @@ -431,7 +430,7 @@ LINE5 cfg.LineNumbersInTable = false result := convertForConfig(c, cfg, lines, "bash") - c.Assert(result, qt.Contains, "<span class=\"ln\">2</span>LINE2\n<") + c.Assert(result, qt.Contains, "<span class=\"ln\">2</span><span class=\"cl\">LINE2\n</span>") result = convertForConfig(c, cfg, lines, "bash {linenos=table}") c.Assert(result, qt.Contains, "<span class=\"lnt\">1\n</span>") }) @@ -454,6 +453,6 @@ LINE5 cfg.LineNumbersInTable = false result := convertForConfig(c, cfg, lines, "") - c.Assert(result, qt.Contains, "<span class=\"ln\">2</span>LINE2\n<") + c.Assert(result, qt.Contains, "<span class=\"ln\">2</span><span class=\"cl\">LINE2\n</span></span>") }) } diff --git a/markup/highlight/highlight_test.go b/markup/highlight/highlight_test.go index f68df629a..53e53b1d9 100644 --- a/markup/highlight/highlight_test.go +++ b/markup/highlight/highlight_test.go @@ -43,7 +43,7 @@ User-Agent: foo h := New(cfg) result, _ := h.Highlight(`echo "Hugo Rocks!"`, "bash", "") - c.Assert(result, qt.Equals, `<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="nb">echo</span> <span class="s2">"Hugo Rocks!"</span></code></pre></div>`) + c.Assert(result, qt.Equals, `<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">echo</span> <span class="s2">"Hugo Rocks!"</span></span></span></code></pre></div>`) result, _ = h.Highlight(`echo "Hugo Rocks!"`, "unknown", "") c.Assert(result, qt.Equals, `<pre tabindex="0"><code class="language-unknown" data-lang="unknown">echo "Hugo Rocks!"</code></pre>`) }) @@ -58,7 +58,7 @@ User-Agent: foo c.Assert(result, qt.Contains, "<span class=\"hl\"><span class=\"lnt\">4") result, _ = h.Highlight(lines, "bash", "linenos=inline,hl_lines=2") - c.Assert(result, qt.Contains, "<span class=\"ln\">2</span>LINE2\n</span>") + c.Assert(result, qt.Contains, "<span class=\"ln\">2</span><span class=\"cl\">LINE2\n</span></span>") c.Assert(result, qt.Not(qt.Contains), "<table") result, _ = h.Highlight(lines, "bash", "linenos=true,hl_lines=2") @@ -101,7 +101,7 @@ User-Agent: foo h := New(cfg) result, _ := h.Highlight(lines, "bash", "") - c.Assert(result, qt.Contains, "<span class=\"ln\">2</span>LINE2\n<") + c.Assert(result, qt.Contains, "<span class=\"cl\">LINE2\n</span></span>") result, _ = h.Highlight(lines, "bash", "linenos=table") c.Assert(result, qt.Contains, "<span class=\"lnt\">1\n</span>") }) @@ -125,7 +125,7 @@ User-Agent: foo h := New(cfg) result, _ := h.Highlight(lines, "", "") - c.Assert(result, qt.Contains, "<span class=\"ln\">2</span>LINE2\n<") + c.Assert(result, qt.Contains, "<span class=\"cl\">LINE2\n</span></span>") }) c.Run("No language, Escape HTML string", func(c *qt.C) { |