html-to-formatted-text
What
Converts HTML to formatted plain text.
From:
"<p>Some text.</p><p>More text.</p><div>Even more text.</div>"
To:
Some text.
More text.
Even more text.
Usage
Node
Installation
npm install --save html-to-formatted-text
const htmlToFormattedText = ;; // Output: "foo\nbar"
ES6
// ES6;; // Output: "foo\nbar"
Vanilla JS / UMD
<!-- latest version --><!-- or for a specific version -->
Why
You might have HTML that you want to display as text.
One use case might be that a user adds HTML via an online editor TinyMCE and you want to display this as plain text somewhere else.
Contributing
- Create an issue on Github
- Fork project
- Make changes then use
npm run commit
to make commits - Create a pull request