Last active
February 5, 2021 10:43
-
-
Save Sanchithasharma/7e193212b414a06f89be3cfb72b6a882 to your computer and use it in GitHub Desktop.
Convert HTML to plain text using html-to-text package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { htmlToText } = require('html-to-text'); | |
const text = htmlToText('<div>Nope Its not Ashton Kutcher. It is Kevin Malone. <p>Equally Smart and equally handsome</p></div>', { | |
wordwrap: 130 | |
}); | |
console.log(text); // expected result: | |
// Nope Its not Ashton Kutcher. It is Kevin Malone. | |
// Equally Smart and equally handsome |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment