Documentation ¶
Overview ¶
Package htmlmut provides helper functions around regexes that help modify HTML documents.
Index ¶
- type MutateFunc
- func AnchorReplace(linkFunc func(string) string) MutateFunc
- func CSSInjector(css string) MutateFunc
- func ChainMutators(mutators ...MutateFunc) MutateFunc
- func ExternScriptInjector(src string) MutateFunc
- func ScriptInjector(script string) MutateFunc
- func StylesheetInjector(cssLink string) MutateFunc
- func TagAttrReplace(tag, attr string, replacer func(string) string) MutateFunc
- func TagRemover(tag string) MutateFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MutateFunc ¶
func AnchorReplace ¶
func AnchorReplace(linkFunc func(string) string) MutateFunc
AnchorReplace replaces all hyperlinks in the HTML document.
func CSSInjector ¶
func CSSInjector(css string) MutateFunc
CSSInjector injects CSS at the end of the head block.
func ChainMutators ¶
func ChainMutators(mutators ...MutateFunc) MutateFunc
func ExternScriptInjector ¶
func ExternScriptInjector(src string) MutateFunc
ExternScriptInjector injects an external JavaScript file to the front of the head block.
func ScriptInjector ¶
func ScriptInjector(script string) MutateFunc
ScriptInjector injects raw JavaScript to the front of the body block.
func StylesheetInjector ¶
func StylesheetInjector(cssLink string) MutateFunc
StylesheetInjector injects a CSS stylesheet at the end of the head block.
func TagAttrReplace ¶
func TagAttrReplace(tag, attr string, replacer func(string) string) MutateFunc
TagAttrReplace replaces attribute values of a given tag and attribute key.
func TagRemover ¶
func TagRemover(tag string) MutateFunc
TagRemover creates a regex-based HTML tag remover.
Click to show internal directories.
Click to hide internal directories.