mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
Use Chroma as new default syntax highlighter
If you want to use Pygments, set `pygmentsUseClassic=true` in your site config. Fixes #3888
This commit is contained in:
committed by
GitHub
parent
81ed564793
commit
fb33d8286d
@@ -24,7 +24,6 @@ import (
|
||||
|
||||
"github.com/gohugoio/hugo/deps"
|
||||
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
"github.com/gohugoio/hugo/tpl"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -80,22 +79,18 @@ func doTestShortcodeCrossrefs(t *testing.T, relative bool) {
|
||||
func TestShortcodeHighlight(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if !helpers.HasPygments() {
|
||||
t.Skip("Skip test as Pygments is not installed")
|
||||
}
|
||||
|
||||
for _, this := range []struct {
|
||||
in, expected string
|
||||
}{
|
||||
{`{{< highlight java >}}
|
||||
void do();
|
||||
{{< /highlight >}}`,
|
||||
"(?s)<div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\">.*?void</span> do().*?</pre></div>\n",
|
||||
`(?s)<div class="highlight"><pre style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java"`,
|
||||
},
|
||||
{`{{< highlight java "style=friendly" >}}
|
||||
void do();
|
||||
{{< /highlight >}}`,
|
||||
"(?s)<div class=\"highlight\" style=\"background: #f0f0f0\"><pre style=\"line-height: 125%\">.*?void</span>.*?do</span>.*?().*?</pre></div>\n",
|
||||
`(?s)<div class="highlight"><pre style="background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java" data-lang="java">`,
|
||||
},
|
||||
} {
|
||||
|
||||
|
Reference in New Issue
Block a user