summaryrefslogtreecommitdiff
path: root/alarm/node_modules/string-strip-html/examples/remove-html.js
blob: b45894e268845679707c4786cf71b4f445c23c32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Remove all HTML from a string

import { strict as assert } from "assert";
import { stripHtml } from "../dist/string-strip-html.esm.js";

const someHtml = `<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <h1>Title</h1>
    Some text.
  </body>
</html>`;

assert.equal(stripHtml(someHtml).result, `Title\nSome text.`);