getElementText()function

getElementText(elements: Elements): string
ParamType
elementsElements
An element, a plain string, or null/undefined (or an array of those things). required
Return
string
The combined string made from the elements.

Strip all tags from elements to produce a plain text string.

  • A <br> element becomes a newline (\n) — matching DOM innerText, so words either side of a line break don't fuse together.

Examples

`- Item with *strong*\n- Item with _em_` becomes `Item with strong Item with em`