Documentation ¶
Overview ¶
Package transform provides template functions for transforming content.
Index ¶
- type Namespace
- func (ns *Namespace) CanHighlight(lang string) bool
- func (ns *Namespace) Emojify(s interface{}) (template.HTML, error)
- func (ns *Namespace) HTMLEscape(s interface{}) (string, error)
- func (ns *Namespace) HTMLUnescape(s interface{}) (string, error)
- func (ns *Namespace) Highlight(s interface{}, lang string, opts ...interface{}) (template.HTML, error)
- func (ns *Namespace) HighlightCodeBlock(ctx hooks.CodeblockContext, opts ...interface{}) (highlight.HightlightResult, error)
- func (ns *Namespace) Markdownify(s interface{}) (template.HTML, error)
- func (ns *Namespace) Plainify(s interface{}) (string, error)
- func (ns *Namespace) Remarshal(format string, data interface{}) (string, error)
- func (ns *Namespace) Reset()
- func (ns *Namespace) Unmarshal(args ...interface{}) (interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
Namespace provides template functions for the "transform" namespace.
func (*Namespace) CanHighlight ¶ added in v0.16.0
CanHighlight returns whether the given language is supported by the Chroma highlighter.
func (*Namespace) Emojify ¶
Emojify returns a copy of s with all emoji codes replaced with actual emojis.
func (*Namespace) HTMLEscape ¶
HTMLEscape returns a copy of s with reserved HTML characters escaped.
func (*Namespace) HTMLUnescape ¶
HTMLUnescape returns a copy of with HTML escape requences converted to plain text.
func (*Namespace) Highlight ¶
func (ns *Namespace) Highlight(s interface{}, lang string, opts ...interface{}) (template.HTML, error)
Highlight returns a copy of s as an HTML string with syntax highlighting applied.
func (*Namespace) HighlightCodeBlock ¶ added in v0.16.0
func (ns *Namespace) HighlightCodeBlock(ctx hooks.CodeblockContext, opts ...interface{}) (highlight.HightlightResult, error)
HighlightCodeBlock highlights a code block on the form received in the codeblock render hooks.
func (*Namespace) Markdownify ¶
Markdownify renders a given input from Markdown to HTML.
func (*Namespace) Remarshal ¶
Remarshal is used in the Hugo documentation to convert configuration examples from YAML to JSON, TOML (and possibly the other way around). The is primarily a helper for the Hugo docs site. It is not a general purpose YAML to TOML converter etc., and may change without notice if it serves a purpose in the docs. Format is one of json, yaml or toml.