Options
PostHTML is configured underbuild.posthtml.options in your config.js.
directives
You can configure the PostHTML parser to correctly process custom directives.For example, you may tell it to ignore
<?php ?> tags instead of treating them as HTML:config.js
xmlMode
Enable
xmlMode if you’re using Maizzle to output XML content, and not actual HTML.config.js
decodeEntities
Set this to
true to have entities within the document decoded.config.js
lowerCaseTags
Set this to
true to output all tags in lowercase. Works only when xmlMode is disabled.config.js
lowerCaseAttributeNames
Output all attribute names in lowercase.
config.js
recognizeCDATA
Recognize CDATA sections as text even if the
xmlMode option is disabled.If
xmlMode is enabled, CDATA sections will always be recognized as text.config.js
recognizeSelfClosing
If enabled, self-closing tags will trigger the Maizzle sets this to
onclosetag event even if xmlMode is disabled.When
xmlMode is enabled self-closing tags will always be recognized.true to ensure self-closing tags like those of Components are rendered correctly.config.js
sourceLocations
If set to
true, AST nodes will have a location property containing the start and end line and column position of the node.config.js
recognizeNoValueAttribute
If set to
true, PostHTML will render attributes with no values exactly as they were written and will not add ="" to them.config.js
singleTags
Use the You may then use the
singleTags option to tell PostHTML to treat custom tags as self-closing.config.js
<custom /> tag as self-closing:emails/example.html
closingSingleTag
Define the closing format for single tags.By default it will not close self-closing tags that it knows about:Available options:
emails/example.html
tag
tag
Will add a closing tag.
config.js
emails/example.html
slash
slash
Will add a closing slash.
config.js
emails/example.html
quoteAllAttributes
Disable if you want to remove quotes on all attributes.
config.js
emails/example.html
replaceQuote
Replaces quotes in attribute values with
"e;.config.js
emails/example.html
quoteStyle
Specify the attribute value quotes style.
config.js
emails/example.html
Plugins
Register any PostHTML plugins that you would like to use, in the
plugins array.You may register plugins to run either before all other plugins, or after all other plugins, by using the before and after keys.config.js
Custom plugins
You may write your own PostHTML plugins, right in your Maizzleconfig.js file.
For example, here’s a plugin that adds a random number to all <img> src URLs:
config.js
Note that this is a naive example that doesn’t take existing query strings into account.