unified

Project: rehypejs/rehype

Package: rehype-cli@10.0.0

  1. Dependencies: 0·Dependents: 0
  2. CLI to process HTML with rehype
  1. unified 155
  2. html 110
  3. rehype 71
  4. cli 5
  5. bin 2

rehype-cli

Build Coverage Downloads Sponsors Backers Chat

Command line interface for rehype.

Sponsors

Support this effort and give back by sponsoring on OpenCollective!

Gatsby 🥇

Vercel 🥇

Netlify

Holloway

ThemeIsle

Boost Hub

Expo


You?

Install

npm:

npm install rehype-cli

Use

# Minify `index.html` with `rehype-preset-minify`:
$ rehype index.html --use preset-minify --output

CLI

See unified-args, which provides the interface, for more information on all available options.

Usage: rehype [options] [path | glob ...]

  CLI to process HTML with rehype using plugins

Options:

  -h  --help                output usage information
  -v  --version             output version number
  -o  --output [path]       specify output location
  -r  --rc-path <path>      specify configuration file
  -i  --ignore-path <path>  specify ignore file
  -s  --setting <settings>  specify settings
  -e  --ext <extensions>    specify extensions
  -u  --use <plugins>       use plugins
  -w  --watch               watch for changes and reprocess
  -q  --quiet               output only warnings and errors
  -S  --silent              output only errors
  -f  --frail               exit with 1 on warnings
  -t  --tree                specify input and output as syntax tree
      --report <reporter>   specify reporter
      --file-path <path>    specify path to process as
      --tree-in             specify input as syntax tree
      --tree-out            output syntax tree
      --[no-]stdout         specify writing to stdout (on by default)
      --[no-]color          specify color in report (on by default)
      --[no-]config         search for configuration files (on by default)
      --[no-]ignore         search for ignore files (on by default)

Examples:

  # Process `input.html`
  $ rehype input.html -o output.html

  # Pipe
  $ rehype < input.html > output.html

  # Rewrite all applicable files
  $ rehype . -o

Security

As rehype works on HTML, and improper use of HTML can open you up to a cross-site scripting (XSS) attack, use of rehype can also be unsafe. Use rehype-sanitize to make the tree safe.

Contribute

See contributing.md in rehypejs/.github for ways to get started. See support.md for ways to get help. Ideas for new plugins and tools can be posted in rehypejs/ideas.

A curated list of awesome rehype resources can be found in awesome rehype.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer