import (
"testing"
+ qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/hugolib"
)
<description><p>a <strong>b</strong> c</p></description>
`)
}
+
+// Issue #9642
+func TestHighlightError(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+disableKinds = ['page','rss','section','sitemap','taxonomy','term']
+-- layouts/index.html --
+{{ highlight "a" "b" 0 }}
+ `
+ b := hugolib.NewIntegrationTestBuilder(
+ hugolib.IntegrationTestConfig{
+ T: t,
+ TxtarString: files,
+ },
+ )
+
+ _, err := b.BuildE()
+ b.Assert(err.Error(), qt.Contains, "error calling highlight: invalid Highlight option: 0")
+}
}
hl := ns.deps.ContentSpec.Converters.GetHighlighter()
- highlighted, _ := hl.Highlight(ss, lang, optsv)
+ highlighted, err := hl.Highlight(ss, lang, optsv)
+ if err != nil {
+ return "", err
+ }
return template.HTML(highlighted), nil
}