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 🙏

© 2026 – Pkg Stats / Ryan Hefner

shadowdark-parser

v4.0.2

Published

Take statblocks, spell descriptions, roll tables and more from shadowdark and converts them into other formats

Readme

Shadowdark Parser

This tool takes statblocks, spell descriptions, rolltables and more copied from shadowdark PDFs and converts them into JSON.

It comes in two forms:

  • A library that you can use in your own code to convert plaintext into structured JSON
  • A CLI that takes in plaintext from files or stdin, and outputs it to JSON, or another file controlled by a Handlebars template file.

Currently, this tool supports:

  • Monsters
  • Spells
  • Magic Items
  • Roll Tables

This parser has several advantages over a lot of other parsers or pre-generated JSON from the core rulebooks:

  • The JSON it outputs is very granular, allowing you to drill down into exactly the parts of the data you want
  • It can take text from Cursed Scrolls and even some third-party products, so you aren't limited to things covered under SD's third-party license (although it goes without saying that the resulting JSON should only be used for personal use)
  • The CLI can output into any format, as defined by a Handlebar template file (example below)
  • The Library has a generic parse function which automatically works out what type of entity it is dealing with (monster, spell, table, etc) and will apply the correct parsing function. The CLI tool uses this too.
  • It is very good at identifying where traits on monsters & items begin & end, even when there's no linebreak between them.

Usage

In your terminal (CLI)

You can use shadowdark-parser via npx to parse a file

npx shadowdark-parser [filename]

Alternatively, if you can't use npm, you can download bundle-cli.js from the GitHub releases and run it with Node.js directly.

Usage: shadowdark-parser [options] [filename]

Arguments:
  filename               The filename to parse. If set to - or left blank, will
                         read from stdin (default: "-")

Options:
  -t, --template <file>  A handlebars template file
  -o, --output <file>    The file to output to
  -b, --bulk             Mark the input as containing multiple entities, one
                         after the other
  -n, --name-from-file   Use the name of the file as the name of the entity.
                         This option will do nothing if the file is stdin
  -h, --help             display help for command

Custom Handlebars Helpers

Some custom helpers have been implemented to help format statblocks:

  • signedNumber which can take a number and ensure it always has a sign (+ or -) in front of it
  • firstChar which returns the first character of a string

Example Handlebars Template

Check out the wiki for some example templates for common use-cases.

In your code (Library)

  1. Run npm install shadowdark-parser (or download bundle.js from GitHub releases if you can't use npm)
  2. Use it in your code:
import { parse } from 'shadowdark-parser';
const stingbat = parse(`
STINGBAT
Darting, orange insect-bat with
four wings and needlelike beak.
AC 12, HP 4, ATK 1 beak +2 (1d4 +
blood drain), MV near (fly), S -2,
D +2, C +0, I -2, W +0, Ch -2, AL N,
LV 1
Blood Drain. Attach to bitten
target; auto-hit the next round.
DC 9 STR on turn to remove.
`);

// ...

Contributions

This repo is open to contributions, but given the complexity of the parser, please ensure that you run all jest tests before making your PR, and write new tests for your features & fixes

Legal Info

Shadowdark Parser is an independent product published under the Shadowdark RPG Third-Party License and is not affiliated with The Arcane Library, LLC. Shadowdark RPG © 2023 The Arcane Library, LLC.