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

pandox

v0.0.2

Published

Rod's extensions for Pandoc, the universal document converter.

Downloads

7

Readme

Pandox

A collection of PANDOc eXtensions

Pandox is a small collection of utilities that extend John MacFarlane's Pandoc, the "universal document converter".

Using

The Command Line Interface

The Pandox extensions are typically invoked by piping a JSON-formatted AST (generated via pandoc -t json FILENAME) in as stdin, and piping the transformed JSON-formatted AST to another pandoc invocation for rendering. For example:

pandoc -t json README.md | coffee lib/up-caser.coffee | pandoc -f json -t html

will generate an HTML version of the README.md file, first applying the filter defined in up-caser.

The npm module includes directly executable scripts for each extension. Hence:

pandoc -t json README.md | pandox-up-caser | pandoc -f json -t html

also works (following npm install -g pandox).

The API (Code-Level) Interface

Pandox processes the JSON-format abstact-syntax tree that pandoc can generate when given the -t json flag. Internally, this is quite similiar to (but not exactly the same as) the Pandoc filters API that exists for Haskell and Python.

If you'd like to try your hand at writing custom JavaScript-based Pandoc filters, simply extend the PandocFilter class or supply a filtering method. For example:

var PandocFilter = require('pandoc-filter').PandocFilter

function upcase(key,value) {
  if(key==='Str') {
    return value.toUpperCase();
  } else {
    return value;
  }
}

var filter = new PandocFilter(upcase);

HOWEVER one should not consider the API fully stable or settled just yet, so some of the semantics might change in future releases. We follow the semver version numbering conventions so it should be easy to tell when a breaking change is introduced, but the PandocFilter API will probably change moderately frequently until we're more satisified with it.

The Extensions

CodeBlockProcessor

The CodeBlockProcessor extension adds several capabilities to the way in which Pandoc handles "fenced code blocks", such as:

```
This is a sample of text inside a "fenced" code block.
```

Pandoc supports several parameters that control the way in which a code block is rendered. The general form is:

```{#THE-ID .CLASS-ONE .CLASS-TWO NAME="VALUE" NAME2="VALUE2"}
This is a sample of text inside a "fenced" code block.
```

where:

  • #THE-ID is used to identify the code block in things like HTML anchors and Latex cross-references.

  • .CLASS-ONEand .CLASS-TWO enumerate HTML classes to assign to the code block, and sometimes influence the rendering in other ways. For example, adding the class .numberLines will cause Pandoc to number the lines in the code block when rendering it.

  • NAME="VALUE" and NAME2="VALUE2" enumerate name-value pairs that can be used to modify the way in which the code block is rendered. For example, adding the pair startFrom=100 will cause Pandoc to number the lines starting with 100 rather than 1.

CodeBlockProcessor adds a few new parameters that can be controlled by name-value pairs.

  • input-file - replaces the body of the code block with the contents of the specified file.

  • input-cmd - replaces the body of the code block with output of the specified command..

  • exec - executes the body of the code block as it were a shell script

  • output-file - writes the body of the code block to the specified file.

  • output-cmd - pipes the body of the code block to the specified command.