package transform

import "github.com/gohugoio/hugo/tpl/transform"

Index

Types

type Namespace

type Namespace struct {
	// contains filtered or unexported fields
}

Namespace provides template functions for the "transform" namespace.

func New

func New(deps *deps.Deps) *Namespace

New returns a new instance of the transform-namespaced template functions.

func (*Namespace) Emojify

func (ns *Namespace) Emojify(s interface{}) (template.HTML, error)

Emojify returns a copy of s with all emoji codes replaced with actual emojis.

See http://www.emoji-cheat-sheet.com/

func (*Namespace) HTMLEscape

func (ns *Namespace) HTMLEscape(s interface{}) (string, error)

HTMLEscape returns a copy of s with reserved HTML characters escaped.

func (*Namespace) HTMLUnescape

func (ns *Namespace) HTMLUnescape(s interface{}) (string, error)

HTMLUnescape returns a copy of with HTML escape requences converted to plain text.

func (*Namespace) Highlight

func (ns *Namespace) Highlight(s interface{}, lang, opts string) (template.HTML, error)

Highlight returns a copy of s as an HTML string with syntax highlighting applied.

func (*Namespace) Markdownify

func (ns *Namespace) Markdownify(s interface{}) (template.HTML, error)

Markdownify renders a given input from Markdown to HTML.

func (*Namespace) Plainify

func (ns *Namespace) Plainify(s interface{}) (string, error)

Plainify returns a copy of s with all HTML tags removed.

func (*Namespace) Remarshal

func (ns *Namespace) Remarshal(format string, data interface{}) (string, error)

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.

Source Files

init.go remarshal.go transform.go

Version
v0.38.1
Published
Apr 5, 2018
Platform
linux/amd64
Imports
10 packages
Last checked
5 minutes ago

Tools for package owners.