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

remark-cli-help

v3.0.0

Published

Add cli help output to a README with remark.

Downloads

8

Readme

remark-cli-help

Build Coverage Downloads Size Sponsors Backers Chat

Add cli help output to a README with remark.

Installation

npm:

npm install remark-cli-help

Usage

Dependencies:

import {remark} from 'remark';
import {VFile} from 'vfile';
import cliHelp from 'remark-cli-help';

Given a file:

const output = remark()
  .use(cliHelp, {bin: 'remark'})
  .processSync(new VFile('## cli'))
  .toString();

Yields:

## cli

```markdown
$ remark-cli-help --help

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

  CLI to process Markdown with remark

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
      --ignore-path-resolve-from dir|cwd  resolve patterns in `ignore-path` from its directory or cwd
      --ignore-pattern <globs>            specify ignore patterns
      --silently-ignore                   do not fail when given ignored files
      --tree-in                           specify input as syntax tree
      --tree-out                          output syntax tree
      --inspect                           output formatted 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.md`
  $ remark input.md -o output.md

  # Pipe
  $ remark < input.md > output.md

  # Rewrite all applicable files
  $ remark . -o
```

API

remark.use(cliHelp[, options])

Adds the output from node ./cli.js --help to the cli section in a readme.md.

Removes the current content between the heading containing the text “cli”, and the next heading of the same (or higher) depth, and replaces it with the help output.

options

options.cwd

string? — Path to a directory containing a node module. Used to infer name, main, and bin.

options.name

string? — Name of the command, inferred from package.jsons name property. Used to write the help command output $ some-command --help.

options.bin

string? — Path to the cli script. Resolved from package.jsons bin property (or cli.js). See the npm documentation for more details

options.args

Array<string>? — Arguments used to run the help command. Defaults to ['--help']

options.heading

string?, default: 'cli' — Heading to look for, wrapped in new RegExp('^(' + value + ')$', 'i');.

Contribute

See contributing.md in remarkjs/remark for ways to get started.

This organisation has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.

License

MIT © Jonathan Haines