How to use the ESCAPEHTML operation for Computed Attributes
Definition
The ESCAPEHTML operation removes all HTML tags from a text.
Example
ESCAPEHTML(“<script>alert(‘Hello’)</script><b>Hello World</b>”)
Result:
Hello World
Syntax Guide
ESCAPEHTML(text)
text - The text string to remove HTML tags from
Formulas In Use
You can copy and paste the formulas below to use in your own account. Just remember to replace the attribute being used ($ATT.RICH_TEXT) with one in your account.
Stripping HTML With Line Breaks
Stripping HTML With Line Breaks and Keeping Bullet Points
Stripping HTML With Line Breaks
In order to remove all the HTML code from a Rich text but still maintain the text in different lines as a paragraph.
Transforming this: “<ul><li>This</li><li>That</li><li>The other<br></li></ul>”
Into this:
“This
That
The other”
Formula:
ESCAPEHTML(SUBSTITUTE($ATT.RICH_TEXT,"<li>", "
"))
Stripping HTML With Line Breaks and Keeping Bullet Points
Maintain bullet points in the plain text version by adding the symbol in the bullet point symbol.
Formula:
ESCAPEHTML(SUBSTITUTE($ATT.RICH_TEXT,"<li>", "
•"))
What's Next?
- Learn more about how to write formulas
- Check out the ESCAPESTYLE operation
- Check out the FILTER operation
If you have any questions just click on the chat box in the bottom-right corner and we'll be happy to answer them...
and please let us know 👇