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

hastings

v0.0.1

Published

Documentation with grit.

Downloads

1

Readme

Hastings

Documentation with grit.

Install

$ npm install hastings

Usage

$ hastings [path] ................. output written to /build/doc/
$ hastings < path ................. output written to stdout
$ hastings watch [path] ........... build and watch for changes
$ hastings init [path] ............ initialize default doc files
$ hastings create template file ... create a template doc file
$ hastings help ................... get help

Simple Usage

# build files in doc/
$ hastings
    => build/doc/

Detailed Usage

# initialize default doc file structure
$ hastings init
    => mkdir doc/
    => mkdir doc/en/
    => touch doc/en/index.md
    => mkdir lib/doc/

# create a getting started guide
$ hastings create guide doc/en/getting-started.md

# live preview of documentation
$ hastings watch
    => [2012-06-08 11:13am] server started at 127.0.0.1:3000
    => [2012-06-08 11:13am] serving build/doc/
    => [2012-06-08 11:13am] rendered doc/en/getting-started.md

Commands

$ hastings [path]

Builds the HTML documentation and outputs the files.

$ hastings
$ hastings doc/
$ hastings documentation/

By default, the documentation path is doc/. This can be overridden with [path].

The optional [path] can be a markdown file or directory. When a file is specified, it is rendered to the the build path. When a directory is specified, then the entire directory is copied to the build path and each markdown file is replaced with a HTML file.

The build output is stored in build/doc.

$ hastings < path

Builds the HTML documentation and pipes output to the console.

$ hastings < doc/
$ hastings < documentation/
    => [outputs a wad of HTML]

The parameter path can be a markdown file or directory.

$ hastings watch [path]

Live edit and preview of the documentation.

$ hastings watch
$ hastings watch doc/
$ hastings watch documentation/
    => [2012-06-08 11:13am] server started at 127.0.0.1:3000
    => [2012-06-08 11:13am] serving build/doc/
    => [2012-06-08 11:13am] rendered doc/en/index.md

By default, the documentation path is doc/. This can be overridden with [path].

The optional [path] can be a markdown file or directory. When a file is specified, it is rendered to the the build path. When a directory is specified, then the entire directory is copied to the build path and each markdown file is replaced with a HTML file.

The build output is stored in build/doc and can be viewed by opening a browser to localhost:3000.

$ hastings init [path]

Initializes a default documentation file structure. This structure is not required.

$ hastings init
    => mkdir doc/
    => mkdir doc/en/
    => touch doc/en/index.md
    => mkdir lib/doc/

By default, the markdown documentation is stored is doc/ and library files are stored in lib/doc/. You are welcome to change the documentation path to match your naming convention but you will then need to specify the path to each command.

$ hastings create template file

Create a new document from a template.

$ hastings create guide doc/en/getting-started.md

The template argument is the type of template to use. There are four templates bundled with hastings:

  • api
  • guide
  • trouble-shooting
  • faq

The file argument is the file to be created.

You are not required to use templates. Although, templates help you to write documentation quicker and more consistently.

Custom templates can be added to lib/doc/template/. The Customization section explains templates in more detail.

$ hastings help

Display the commands available to hastings.

$ hastings help

Customization

Templates

You can add custom templates and override the existing ones.

Add any markdown file to lib/doc/template/ and the filename is used as the template name.

For example you can make lib/doc/template/getting-started.md as a Getting Started template. You can then create a document from the template with the command:

$ hastings create getting-started doc/hello-world.md

You can override a default template by create a file in lib/doc/template/ with the same name. For example, to override guide you can create the file lib/doc/template/guide.md.

Themes

You can add a custom HTML theme for your documentation.

Add a HTML theme to lib/doc/theme/ and it will override the default theme. When building your documentation, the entire theme directory is copied to build/doc/.

index.html is your HTML theme template. Add the element <hastings/> where you want the content of each markdown file to be inserted.

<html>
    <head>
        ...
    </head>
    <body>
        ...
        <hastings/>
        ...
    </body>
</html>