mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-14 20:37:55 -05:00
tpl/debug: Add VisualizeSpaces
This commit is contained in:
parent
46a3cf6186
commit
f1062519ae
1 changed files with 8 additions and 0 deletions
|
@ -16,6 +16,8 @@ package debug
|
|||
|
||||
import (
|
||||
"github.com/sanity-io/litter"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/yuin/goldmark/util"
|
||||
|
||||
"github.com/gohugoio/hugo/deps"
|
||||
)
|
||||
|
@ -41,3 +43,9 @@ type Namespace struct {
|
|||
func (ns *Namespace) Dump(val any) string {
|
||||
return litter.Sdump(val)
|
||||
}
|
||||
|
||||
// VisualizeSpaces returns a string with spaces replaced by a visible string.
|
||||
func (ns *Namespace) VisualizeSpaces(val any) string {
|
||||
s := cast.ToString(val)
|
||||
return string(util.VisualizeSpaces([]byte(s)))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue