mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-27 22:09:53 +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
@@ -55,7 +55,8 @@ func (ns *Namespace) Highlight(s interface{}, lang, opts string) (template.HTML,
|
||||
return "", err
|
||||
}
|
||||
|
||||
return template.HTML(helpers.Highlight(ns.deps.Cfg, html.UnescapeString(ss), lang, opts)), nil
|
||||
highlighted, _ := ns.deps.ContentSpec.Highlight(html.UnescapeString(ss), lang, opts)
|
||||
return template.HTML(highlighted), nil
|
||||
}
|
||||
|
||||
// HTMLEscape returns a copy of s with reserved HTML characters escaped.
|
||||
|
@@ -226,9 +226,14 @@ func TestPlainify(t *testing.T) {
|
||||
func newDeps(cfg config.Provider) *deps.Deps {
|
||||
l := helpers.NewLanguage("en", cfg)
|
||||
l.Set("i18nDir", "i18n")
|
||||
cs, err := helpers.NewContentSpec(l)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return &deps.Deps{
|
||||
Cfg: cfg,
|
||||
Fs: hugofs.NewMem(l),
|
||||
ContentSpec: helpers.NewContentSpec(l),
|
||||
ContentSpec: cs,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user