htmlmut

package
v0.0.0-...-194be0d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2020 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package htmlmut provides helper functions around regexes that help modify HTML documents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MutateFunc

type MutateFunc = func([]byte) []byte

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL