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

markdowny

v1.1.0

Published

A set of command-line tools for working with Markdown files with YAML headers.

Downloads

13

Readme

markdowny

A set of command-line utilities for working with Markdown + YAML files, specifically for novels and short stories.

Setup and usage

Install markdowny using npm as a utility:

npm install --global markdowny

Basic usage is:

markdown verb *.markdown
markdowny-wc *.markdown

Verbs

version

Retrieves the version of the command-line utility and prints it out to the console.

markdowny version

content

Extract the content from one or more files.

markdowny content *.markdown

count

Counts the number of words excluding the YAML header and displays it.

markdowny count *.markdown [options]

Options:

  • -t, --total: Add a total line to the bottom that combines.
  • -s, --separator: Comma-separates the numbers in the total.

extract

Extract the metadata (front matter) from one or more files.

markdowny extract *.markdown [options]

Options:

  • --no-list: Don't write out the extract data as a list/sequence of items (default).
  • -y, --yaml: Extract the data as YAML instead of JSON (default).
  • --content PROPERTY: Extract the content as a property of the given name instead of just removing it. Defaults to not extracting the content.

list

Displays each file as a Markdown ordered list.

markdowny list *.markdown

Options:

  • -o, --output: Direct the output to a file or (default) standard out with -.
  • -s, --trim-whitespace: If included, then newlines between the fields will be collapsed down to a single space and the resulting string trimmed at both ends.
  • -t, --template: The Handlebars template using the YAML metadata for each file in addition to a _number which is the one-based number of the file. The default value is {{_number}}. {{{title}}}: {{{summary}}}.
    • Some additional conditional operations are allowed such as ge, le, gt, ge, eq, and ne. They can be used like {{#if (lt _number 10)}}0{{/if}}.

sections

Displays each file as a heading 1 section with the title and contents provided.

Assuming that a file has a title and summary (which can be multiple lines) inside it, display a section for each file with the title as heading 1 and the contents of the summary value as the text for that section.

markdowny sections *.markdown -t title -f summary

Options:

  • -t, --title: The name of the property to put in for the section. May be nested such as author.name.first. Defaults to title.
  • -f, --field: The name of the property used for the contents of the section. Defaults to summary.

table

Displays a table of one or more fields inside the summary.

To list every file, it's title, the number of words inside it, and the list of secondary characters inside a nested value. The :rs makes the "Words" column right-aligned (r) and comma-separated (s).

markdowny table *.markdown -f _basename title _words characters.secondary -t File Title Words:rs "Secondary Characters"

Options:

  • -f, --fields: A parameter-separated list of YAML fields to list in the table, in the order they should be shown. Defaults to _basename title. These may also have a format specifier, starting with : (see below). This may be a nested value, such as characters.secondary.
  • -t, --titles: A parameter-separated list of titles for the columns. If there are more fields than titles, the field names will be used for the headers. These may have format specifiers.
  • --table-start: The characters to insert at the beginning of the row. Defaults to | .
  • --table-end: The characters to insert at the end of each row. Defaults to |.
  • --table-delimiter: The characters to insert between each field. Defaults to |.
  • --no-table-rule: Do not put a dashed line between the header and the various files.
  • --no-table-header: Do not display the header titles. The format of the headers is still parsed and used.
  • --list-delimiter: The characters to put between list items when inserted into a field. Defaults to , .
  • --prefix: The filename prefix that is trimmed from the _filename propery.

There are a number of special properties that are included in all files.

  • _filename: The full path of the filename, with the --prefix removed.
  • _basename: The name of the file without a directory.
  • _words: The number of words in the file, excluding the YAML header.