1var textVersion = require("textversionjs");
2var htmlText = "<html>" +
3 "<body>" +
4 "Lorem ipsum <a href=\"http://foo.foo\">dolor</a> sic <strong>amet</strong><br />" +
5 "Lorem ipsum <img src=\"http://foo.jpg\" alt=\"foo\" /> sic <pre>amet</pre>" +
6 "<p>Lorem ipsum dolor <br /> sic amet</p>" +
7 "<script>" +
8 "alert(\"nothing\");" +
9 "</script>" +
10 "</body>" +
11 "</html>";
12
13var plainText = textVersion(htmlText);
14// returns
15// "Lorem ipsum [dolor] (http://foo.foo) sic amet
16// Lorem ipsum ![foo] (http://foo.jpg) sic amet
17// Lorem ipsum dolor
18// sic amet"