Documentation
¶
Overview ¶
Package variables expands template variables inside Markdown content. Variables such as {{ book.title }} and {{ book.author }} are replaced before parsing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Expand ¶
func Expand(source []byte, cfg *config.BookConfig) []byte
Expand replaces template variables in Markdown source using config values.
func ExpandWithUnknown ¶ added in v0.8.0
func ExpandWithUnknown(source []byte, cfg *config.BookConfig) ([]byte, []string)
ExpandWithUnknown replaces template variables and also reports the ones it did not recognize, so the caller can warn instead of shipping a literal "{{ book.autor }}" to the reader.
Substitution deliberately skips fenced code blocks and inline code spans. A book that documents a templating syntax — including mdpress's own manual — shows that syntax inside code, and rewriting it there corrupts the example the page exists to display.
Types ¶
This section is empty.