stripHtml
Plain text of an HTML fragment: tags removed, <script>, <style> and comments dropped
with their content, entities decoded (a common named subset, plus decimal and hex
numeric ones) and whitespace collapsed and trimmed. Block-level tags and <br> count as
a space, so <p>a</p><p>b</p> gives a b.
Not a sanitizer: this is for text extraction. Never use its output to make HTML safe, use escapeHtml for that.
Available since v3.1.4
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
html | string | The HTML fragment |
Returns
Section titled “Returns”string — The plain text
Examples
Section titled “Examples”Plain text from HTML
Section titled “Plain text from HTML”Removes tags and decodes entities, including and numeric ones.
Block tags separate words
Section titled “Block tags separate words”Paragraphs, list items and line breaks become a space so words do not stick together.
