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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@david.casillas/writer-chapter-tool

v1.0.0

Published

Command line utility to manage a writing split in chapter files.

Downloads

48

Readme

writer-chapter-tool

Command line utility to manage a lightweight markup writing (markdown for example) split in chapter files.

Prerrequisites

This is a Node.js tool, so you need to have installed it in your system. Download & Install Node.js and the npm package manager.

Geting started

Installing

Install this package globally to have access to the command line cli.

$ npm install -g @david.casillas/writer-chapter-tool

Configuring

By default the tool is configured to work with markdown files, this affects the file extension and the format of the headings inserted in every new chapter file created. There is a config option to change the syntax used, but by now only markdown is supported.

$ wct config-set language markdown

There are 2 options to control the editor used to open chapter files and the preview tool. Set then to your favourite apps using:

$ wct config-set editor BBEdit
$ wct config-set editor Markdown

To check the current available options:

$ wct config-list

All options are global and will affect all your projects. There is still no local per project settings.

How to use

After installation create a folder to start your project. The folder will start empty.

$ mkdir mybook
$ cd mybook

Creating chapters

Start your book creating your first chapter. Since there was nothing created before this will create folders src and src/images in your project folder.

$ wct chapter-create 'Starting here'

Now a markdown file for the content of the chapter and a folder src/images/00 to hold the images will be created. Let's see the contents of the project src folder right know:

$ ls -la src

.
|- 00-Starting here.md
|- images
|---- 00

The markdown file contains the header of the chapter:

$ cat src/00-Starting here.md

## Starting here

Let's create another chapter.

$ wct chapter-create 'Other chapter'

This will add another chapter, increasing the chapter number. The first chapter is chapter 0.

$ ls -la src

.
|- 00-Starting here.md
|- 01-Other chapter.md
|- images
|---- 00
|---- 01

Managing chapters

We can see a list of chapters with the list command.

$ wct chapter-list

00-Starting here
01-Other chapter

Let's rename a chapter and change its position in the book.

$ wct chapter-rename 1 'Now I'm the first chapter'
$ wct chapter-move 1 0
$ wct chapter-list

00-Now I'm the first chapter
01-Starting here

Now what was chapter number 1 is now in the 0 position and has been renamed.

We can delete a chapter, ¡be sure to be using version control, since this can not be undone!

$ wct chapter-delete 0
$ wct chapter-list

00-Starting here

As you can see deleting a chapter reindexes the rest of chapters so they range from 0 to the last chapter.

Adding content to chapters

Finally to start writing on a chapter:

$ wct chapter-edit 0

By default the edit command opens the markdown file in BBEdit editor to edit it and in Marked to have a live preview of the content. Check the config section to change the applications used to edit and preview.

In case you need to add images to your document copy the image file in the apropiate folder under src/images matching the chapter number. Then in your document reference the image. Here is an example using markdown syntax.

[images/00/my-image.jpg]()

Preview the book

The command preview merges the contents of the src folder into a single markdown file and copies it to the build folder. The images folder is copied as is from src to build so all images keep working with no modification.

The command also opens the result in the application configured to preview the content.

API

This is a full list of all API commands available:

  • mwt chapter-create <chapter_title>
  • mwt chapter-move <old_chapter_number> <new_chapter_number>
  • mwt chapter-delete <chapter_number>
  • mwt chapter-edit <chapter_number>
  • mwt chapter-rename <chapter_number> <new_title>
  • mwt chapter-list
  • mwt book-compile
  • mwt config-list
  • mwt config-set <property> <value>

API shortcuts

Commands have a shortcut build from the first letter of every command name part. For example the command mwt chapter-list can be written as wct cl.

Config commands do not have a shortcut.

License

This project is licensed under the MIT License - see the LICENSE.md file for details