html-text

Extract text from HTML.

Usage no npm install needed!

<script type="module">
  import htmlText from 'https://cdn.skypack.dev/html-text';
</script>

README

HTML Text Travis CI Build Status

Extract text from HTML.

NPM Badge

Install

npm install html-text

Strategy

The input HTML is prettified to clean it up and unindent the code, stripped from tags and trimmed to removed newlines and spaces.

Usage

const htmlText = require("html-text");

htmlText(`
<!DOCTYPE html>
<html id="home" lang="en">

<body>
  <main>
    <p>Site Content.</p>
  </main>
</body>

</html>
`);
//=> 'Site Content.'

API

htmlText(input)

input

Type: string

The HTML to strip the tags from.