Documentation
¶
Overview ¶
Package shortcode provides Hugo-compatible shortcode registration and expansion.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AudioHandler ¶
AudioHandler implements the {{< audio src="..." title="..." >}} shortcode. Mirrors themes/zozo/layouts/shortcodes/audio.html.
func ImgHandler ¶
ImgHandler implements the {{< img src="..." title="..." >}} shortcode. Mirrors themes/zozo/layouts/shortcodes/img.html.
func RedactHandler ¶
RedactHandler implements the {{< redact >}} shortcode.
Parameters:
force="true" - force full redaction show="true" - force no redaction random="true" - random partial redaction ratio="50" - redaction ratio (0-100), default 50
Behavior:
- If force=true → redact
- If show=true → no redact
- Else, check page frontmatter "redact" field
- Else, check global redactFolders config (matches page directory)
- Apply full or random redaction based on mode
Types ¶
type Context ¶
type Context struct {
Params map[string]string
Inner string // content between {{< x >}}...{{< /x >}}
Args []string
Page *content.Page
Site *content.Site
}
Context is what a shortcode handler receives.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds all registered shortcode handlers.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates a new shortcode registry with built-in shortcodes registered.
func (*Registry) Expand ¶
Expand processes all shortcodes in the given markdown body. It handles both inline (self-closing) and block (with inner content) forms. Unknown shortcodes are left in place untouched.