npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@html-to/text-cli

v0.5.4

Published

CLI html to plain text converter

Downloads

7,030

Readme

@html-to/text-cli

Command line interface for html-to-text Node.js package.

Features

  • almost all html-to-text options can be specified via command line arguments or json config (the only exception is functions such as custom formatters);
  • a couple of presets for common use cases (human reading in terminal and machine indexing/search).

Changelog

Available here: CHANGELOG.md

Installation

npm i -g @html-to/text-cli

Name collisions

  • old versions of html-to-text package expose a command with the same name. Make sure that package is not installed globally anymore.
  • there is an old abandoned CLI package that exposes a command with the same name and actually has nothing to do with html-to-text package. Make sure to only use namespaced package @html-to/text-cli.

Usage

  • Use html-to-text command (html-to-text.cmd in PowerShell);
  • Pipe HTML to stdin;
  • Get plain text from stdout;
  • Pass converter options as command arguments.

Command line arguments

> cat ./input.html | html-to-text [commands...] [keys and values...] > ./output.txt

In PowerShell:

PS> Get-Content .\input.html | html-to-text.cmd [commands...] [keys and values...] > .\output.txt

.ps1 wrapper installed by npm might not work with stdin, so use .cmd instead.

Available commands

| Command | Alias | Argument | Description | --------- | ----- | -------------- | ----------- | json | -j | <file_name> | Merge given json file contents with the parsed options object. This way you can provide all or some options from a file rather than explicitly from CLI. | preset | -p | <preset_name> | Merge given preset into the parsed options object. Available presets listed below. | inspect | -i | | Pretty print the parsed options object and exit. Useful as a dry run to check how options are parsed. | unparse | -u | | Print the parsed options object back as args string and exit. Can be used to check what arguments produce the result equivalent to a given json file. | help | -h | | Print help message end exit. | version | -v | | Print version number and exit.

Note: short aliases cannot be merged.

Available presets

| Preset | Description | --------- | ----------- | human | Some options more suitable for human reading in terminal (ensure line length of 80 characters, format tables visually) | machine | Some options more suitable for machine processing (no line length limit, format tables and cells as blocks)

Options syntax

Refer to html-to-text help output for brief syntax information.

Refer to aspargvs readme for more detailed information.

Note: PowerShell requires to escape quotes and curly braces.

Option examples

All options that are representable in JSON format (that is all except functions) can be specified via CLI arguments. Below are some examples.

| JSON | CLI | --------------------- | --- | { preserveNewlines: true } | --preserveNewlines | { wordwrap: 100 } | --wordwrap=100 | { wordwrap: false } | --!wordwrap | { baseElements: { orderBy: 'occurrence' } } | --baseElements.orderBy=occurrence | { selectors: [{ selector: 'img', format: 'skip' }] } | --selectors[] {} :selector=img :format=skip | { selectors: [{ selector: 'h1', options: { uppercase: false } },{ selector: 'h2', options: { uppercase: false } }] }| --selectors[] {} :selector=h1 :!options.uppercase {} :selector=h2 :!options.uppercase | { selectors: [{ selector: 'table', format: 'dataTable', options: { uppercaseHeaderCells: false } }] } | --selectors[] {} :selector=table :format=dataTable :options.uppercase-header-cells=false | { selectors: [{ selector: 'a', options: { linkBrackets: ['<', '>'] } }] } | --selectors[] {} :selector=a :options.linkBrackets=['<','>']

License

MIT License