Skip to main content

HTML Utils Component

Helpful HTML-related functions for building HTML documents and HTML-based emails.

Component key: html-utils

Description

The HTML Utils component provides helpful functions for building and formatting HTML documents.

Actions

Convert to Inline CSS

Convert an HTML document to use inline styles | key: convertInlineCss

This action leverages the juice NPM package to apply CSS defined in <style> tags to inline HTML elements.

Output Example Payload

{
"data": "<html>\n <head>\n <title>My Webpage</title>\n </head>\n <body>\n <div style=\"color: red;\">Hello World</div>\n </body>\n</html>\n"
}

Format HTML

Apply prettier to an HTML document | key: formatHtml

Output Example Payload

{
"data": "<html>\n <head>\n <title>My Webpage</title>\n <style>\n div{color:red;}\n </style>\n </head>\n <body>\n <div>Hello World</div>\n </body>\n</html>\n"
}

Strip HTML Tags

Remove all HTML tags from a string | key: stripHtmlTags