You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A CLI and an API to convert HTML into plain text. Can be used to fetch a site's HTML version and convert it into plain text, or to deliver plain text versions of your site dynamically.
You can also convert HTML into HTML, ignoring certain document elements, and starting at a root element other than <html>. You can choose to take raw Markdown output as well, instead of the default terminal-formatted plain text.
Install
Globally or locally.
npm install hget --save
npm install hget -g
API
The API exports a function that takes in HTML and returns a formatted plain text string. It uses colors and formatting provided by chalk.
root sets the context root, it defaults to 'body'. Maybe you want to use 'main' or something akin to that.
ignore can be a single selector or an array of selectors. Any elements that match the provided selectors will be removed from the document before rendering the terminal-printable output. Keep in mind that these selectors will be rooted in the root element.
html means that you'll get HTML back, instead of the default human-readable terminal output
markdown means you'll get Markdown back, instead of the default human-readable terminal output