Skip to content

htmltoplain

Written as htmltoplain(argnum flags):options in a transform expression.

Minimum arguments 1
Maximum arguments 1
Default arguments 1
Argument modes SINGLE_PRIMITIVE

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
Input args: ["<p>Hello <b>World</b></p>"]
Transforms: "htmltoplain:"
Output: "Hello World"
Input args: ["<div><style>body{color:red}</style><script>alert()</script>Text</div>"]
Transforms: "htmltoplain:"
Output: "Text"
Input args: ["<p>Line1<br>Line2</p>"]
Transforms: "htmltoplain:"
Output: "Line1\nLine2"