A collection of utility functions for processing HTML, Markdown, and strings, including removing image styles and dimensions, pretty-formatting HTML, and creating URL-friendly slugs.
- Description:
A collection of utility functions for processing HTML, Markdown, and strings, including removing image styles and dimensions, pretty-formatting HTML, and creating URL-friendly slugs.
- Source:
(require("utils"))()
Methods
(static) cleanHtml(html) → {Promise.<string>}
- Description:
Processes HTML by removing image styles and then pretty-formatting it.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
html |
string | The HTML string to process. |
Returns:
A Promise that resolves with the processed and pretty-formatted HTML string.
- Type
- Promise.<string>
(static) htmlRemoveImageStyles(html) → {Promise.<string>}
- Description:
Removes all style attributes from img tags in an HTML string using PostHTML.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
html |
string | The HTML string to process. |
Returns:
A Promise that resolves with the processed HTML string.
- Type
- Promise.<string>
(static) markdownRemoveImageDimensions(markdown) → {string}
- Description:
Removes width and height attributes from image tags in a Markdown string.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
markdown |
string | The Markdown string to process. |
Returns:
The Markdown string with width and height attributes removed from image tags.
- Type
- string
(static) urlize(string) → {string}
Parameters:
Name | Type | Description |
---|---|---|
string |
string | The string to convert. |
Returns:
The URL-friendly slug.
- Type
- string