User-defined escaping rules

Adds an extension point for user-defined escaping rules. Useful when generating formats other than HTML, such as Markdown, CSV, LaTeX, etc.