htmltoplain
Written as htmltoplain(argnum flags):options in a transform expression.
| Minimum arguments | 1 |
| Maximum arguments | 1 |
| Default arguments | 1 |
| Argument modes | SINGLE_PRIMITIVE |
Documentation
Section titled “Documentation”Convert HTML content to plain text by stripping all markup and non-displayable content.
This transform takes HTML input and returns clean plain text with:
- All HTML tags removed
- Script and style content removed
- HTML entities decoded
- Whitespace normalized
- Basic text formatting preserved (line breaks, paragraphs)
Notes:
- The transform handles malformed HTML gracefully
- Does not preserve complex formatting like tables or lists
- Converts HTML entities to their character equivalents
- Multiple spaces/newlines are collapsed
- Returns empty string if input contains no text content
| Flag | Letter |
|---|---|
| noncaptive_input | I |
Examples
Section titled “Examples”Basic HTML conversion
Section titled “Basic HTML conversion”Input args: ["<p>Hello <b>World</b></p>"]Transforms: "htmltoplain:"Output: "Hello World"With complex HTML
Section titled “With complex HTML”Input args: ["<div><style>body{color:red}</style><script>alert()</script>Text</div>"]Transforms: "htmltoplain:"Output: "Text"Preserving line breaks
Section titled “Preserving line breaks”Input args: ["<p>Line1<br>Line2</p>"]Transforms: "htmltoplain:"Output: "Line1\nLine2"