mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
deps: Upgrade github.com/alecthomas/chroma/v2 v2.4.0
This commit is contained in:
@@ -286,7 +286,7 @@ func TestConvertAttributes(t *testing.T) {
|
||||
conf.Highlight.NoClasses = false
|
||||
},
|
||||
"```bash {linenos=table, anchorlinenos=true, lineanchors=org-coderef--xyz}\necho 'foo';\n```",
|
||||
"<div class=\"highlight\"><div class=\"chroma\">\n<table class=\"lntable\"><tr><td class=\"lntd\">\n<pre tabindex=\"0\" class=\"chroma\"><code><span class=\"lnt\" id=\"org-coderef--xyz-1\"><a style=\"outline: none; text-decoration:none; color:inherit\" href=\"#org-coderef--xyz-1\">1</a>\n</span></code></pre></td>\n<td class=\"lntd\">\n<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=\"s1\">'foo'</span><span class=\"p\">;</span>\n</span></span></code></pre></td></tr></table>\n</div>\n</div>",
|
||||
"<div class=\"highlight\"><div class=\"chroma\">\n<table class=\"lntable\"><tr><td class=\"lntd\">\n<pre tabindex=\"0\" class=\"chroma\"><code><span class=\"lnt\" id=\"org-coderef--xyz-1\"><a href=\"#org-coderef--xyz-1\">1</a>\n</span></code></pre></td>\n<td class=\"lntd\">\n<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=\"s1\">'foo'</span><span class=\"p\">;</span>\n</span></span></code></pre></td></tr></table>\n</div>\n</div>",
|
||||
},
|
||||
{
|
||||
"Code block, CodeFences=true,lineanchors, default ordinal",
|
||||
@@ -297,9 +297,9 @@ func TestConvertAttributes(t *testing.T) {
|
||||
},
|
||||
"```bash {linenos=inline, anchorlinenos=true}\necho 'foo';\nnecho 'bar';\n```\n\n```bash {linenos=inline, anchorlinenos=true}\necho 'baz';\nnecho 'qux';\n```",
|
||||
[]string{
|
||||
"<span class=\"ln\" id=\"hl-0-1\"><a style=\"outline: none; text-decoration:none; color:inherit\" href=\"#hl-0-1\">1</a></span><span class=\"cl\"><span class=\"nb\">echo</span> <span class=\"s1\">'foo'</span>",
|
||||
"<span class=\"ln\" id=\"hl-0-2\"><a style=\"outline: none; text-decoration:none; color:inherit\" href=\"#hl-0-2\">2</a></span><span class=\"cl\">necho <span class=\"s1\">'bar'</span>",
|
||||
"<span class=\"ln\" id=\"hl-1-2\"><a style=\"outline: none; text-decoration:none; color:inherit\" href=\"#hl-1-2\">2</a></span><span class=\"cl\">necho <span class=\"s1\">'qux'</span>",
|
||||
"<span class=\"ln\" id=\"hl-0-1\"><a class=\"lnlinks\" href=\"#hl-0-1\">1</a></span><span class=\"cl\"><span class=\"nb\">echo</span> <span class=\"s1\">'foo'</span>",
|
||||
"<span class=\"ln\" id=\"hl-0-2\"><a class=\"lnlinks\" href=\"#hl-0-2\">2</a></span><span class=\"cl\">necho <span class=\"s1\">'bar'</span>",
|
||||
"<span class=\"ln\" id=\"hl-1-2\"><a class=\"lnlinks\" href=\"#hl-1-2\">2</a></span><span class=\"cl\">necho <span class=\"s1\">'qux'</span>",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@@ -95,7 +95,7 @@ func (cfg Config) ToHTMLOptions() []html.Option {
|
||||
html.BaseLineNumber(cfg.LineNoStart),
|
||||
html.LineNumbersInTable(cfg.LineNumbersInTable),
|
||||
html.WithClasses(!cfg.NoClasses),
|
||||
html.LinkableLineNumbers(cfg.AnchorLineNos, lineAnchors),
|
||||
html.WithLinkableLineNumbers(cfg.AnchorLineNos, lineAnchors),
|
||||
html.InlineCode(cfg.Hl_inline),
|
||||
}
|
||||
|
||||
|
@@ -86,8 +86,7 @@ User-Agent: foo
|
||||
h := New(cfg)
|
||||
|
||||
result, _ := h.Highlight(lines, "bash", "")
|
||||
// From Chroma v0.8.2 this is linkable: https://github.com/alecthomas/chroma/commit/ab61726cdb54d5a98b6efe7ed76af6aa0698ab4a
|
||||
c.Assert(result, qt.Contains, "<span class=\"lnt\" id=\"2\"><a style=\"outline: none; text-decoration:none; color:inherit\" href=\"#2\">2</a>\n</span>")
|
||||
c.Assert(result, qt.Contains, "<span class=\"lnt\" id=\"2\"><a class=\"lnlinks\" href=\"#2\">2</a>\n</span>")
|
||||
result, _ = h.Highlight(lines, "bash", "lineanchors=test")
|
||||
result, _ = h.Highlight(lines, "bash", "anchorlinenos=false,hl_lines=2")
|
||||
c.Assert(result, qt.Not(qt.Contains), "id=\"2\"")
|
||||
|
Reference in New Issue
Block a user