mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-16 20:53:59 +02:00
@@ -18,6 +18,7 @@ import (
|
||||
"html"
|
||||
"html/template"
|
||||
|
||||
"github.com/alecthomas/chroma/lexers"
|
||||
"github.com/gohugoio/hugo/cache/namedmemcache"
|
||||
"github.com/gohugoio/hugo/common/herrors"
|
||||
"github.com/gohugoio/hugo/markup/converter/hooks"
|
||||
@@ -90,6 +91,11 @@ func (ns *Namespace) HighlightCodeBlock(ctx hooks.CodeblockContext, opts ...inte
|
||||
return hl.HighlightCodeBlock(ctx, optsv)
|
||||
}
|
||||
|
||||
// CanHighlight returns whether the given language is supported by the Chroma highlighter.
|
||||
func (ns *Namespace) CanHighlight(lang string) bool {
|
||||
return lexers.Get(lang) != nil
|
||||
}
|
||||
|
||||
// HTMLEscape returns a copy of s with reserved HTML characters escaped.
|
||||
func (ns *Namespace) HTMLEscape(s interface{}) (string, error) {
|
||||
ss, err := cast.ToStringE(s)
|
||||
|
Reference in New Issue
Block a user