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

panino

v2.2.6

Published

API documentation generator with a strict grammar and testing tools

Downloads

41

Readme

Introduction

Panino is an API documentation generation tool. It can read comments from your source files, or, parse Markdown files and generate the same documentation. Panino runs on Node.js, and uses Jade as its templating engine.

Panino parses your content following a strict, no-crap-allowed grammar that ensures correct and consistent documentation, because you've written it following a specific syntax. This means that there is a very specific set of rules and expectations as to how to write your documentation. These rules are not terribly hard or unweildly. Keeping documentation parsed through a grammar ensures thorough and consistent docs, no matter who it's written by. It can parse your source files in two ways:

  1. By using the pdoc-notation for documentation. This blog post identifies some of the advantages over other commenting-to-documentation systems. The pdoc system was originally based on ndoc.)
  2. By using a JSDoc-like notation for comments. The inspiration and much of the work for this parsing comes from a port of JSDuck. While some of the conventions of JSDuck are kept, this should not be considered a 100% port.

For more help, including syntax and tag definitions, see the wiki.

Who Uses It?

Features

  • Support for Markdown files
  • Creating a separate page for every class
  • Support for proper "[[ ]]"-notation linking (_e.g. [[Class.foo]] renders to a link wrapped in a <code> tag)
  • Adding "shortened" descriptions, truncating the full description into a single sentance
  • Ability to linkify everything (object types in signatures, return types, e.t.c.)
  • Allowing to specify a URL to retrieve documentation about global objects (like Array or String)
  • Support for content references (or conrefs). Conrefs are a way to write a sentance once, and refer to it in multiple locations.
  • Documentation runs through a test suite to ensure the validity of all links and images
  • Support for arbitrary metadata on classes and members (that can be used in templates)
  • Support for arbitrary Markdown-to-HTML page conversion

Markdown is converted using namp.

Installation

You'll need node.js and npm installed. Then, you can can choose to install Panino globally:

npm install -g panino

I usually write a simple build script to do the work. Here's how that might look for a pdoc-like system:

var options = {
  title       : "Some test docs",
  output      : './output',
  skin        : "./skins/goose/templates/layout.jade",
  assets      : "./skins/goose/assets",
  additionalObjs : "./additionalObjs.json",
  parseOptions   : "./nodeParseOptions.json"
};

var files = wrench.readdirSyncRecursive("./nodejs_ref_guide").map(function(f) {
  return path.join(__dirname + "/nodejs_ref_guide/" + f);
});

panino.parse(files, options, function (err, ast) {
  if (err) {
    console.error(err);
    process.exit(1);
  }

  panino.render('html', ast, options, function (err) {
    if (err) {
      console.error(err);
      process.exit(1);
    }
  });
});

Otherwise, you can try to call it from the CLI:

node panino [source_files_directory]

Internals

Panino has two processes: a parsing phase, and a rendering phase.

panino.parse() takes three arguments:

  • An array of files to use
  • Build options
  • A callback that returns err and the parsed ast

panino.render takes four arguments:

  • The rendering mode; this can be html or json, or c9ac to provide a format compatible with Cloud9 IDE's auto completion tool. You can also create your own renderers.
  • The previously created ast
  • Build options
  • A final callback to check for err

Reporting

Panino also supports reporting methods that are missing documentation. Currently, this is only supproted for "jsd"-style parsing. There are two ways to report missing documentation:

  • By passing in report: true, Panino will print out a list of missing methods in a class, along with a percentage indicating the overall coverage.
  • By passing in reportOnly: true, Panino's parse() will return a reportObject instead of an ast, as the second argument in the callback. You can then take this object and iterate over it any way you choose.

Regardless of whether or not you report them, missing methods are inserted into the final documentation.

License

This project is distributed under the MIT license.

Why the Name?

Panino refers to a type of sandwich in Italy. Panini is its plural form, but is often mistakenly used as the singular. It seemed important to draw attention to the fact that what you're defining should represent what it actually is, in documentation and beyond.