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

ragged-blocks

v1.1.0

Published

Algorithms for visualizing structured text

Readme

Ragged Blocks

This is the source repository accompanying our paper, Ragged Blocks: Rendering Structured Text With Style. It contains the implementation of every algorithm we benchmarked in the paper, as well as a demo application that demonstrates the algorithms on layout trees of the reader's choice.

Building

Simply run tsc in the root of the repository, or npm run build.

Running the Demo

First, ensure that the library has been built by running tsc in the root of the repository.

Then, navigate to the demo directory in the root of the repository, and run webpack serve. Now, open localhost:8080 in a web browser. The page will be refreshed each time a modification is made to the demo code.

If you want the page to be refreshed when the library code is changed too, you can run tsc --watch in the root of the repository in a different terminal.

Running the Tests

Just run npm test.

jest is used for unit tests, but we can't invoke jest by iself because we need the underlying node instance to be run with --experimental-vm-modules (which, in turn, is required because we use top-level await in the tests which need to load external image files). See package.json for the full command that's run when you run npm test.

Running a Particular Test

e.g.

node --no-warnings --experimental-vm-modules node_modules/.bin/jest -t atom-newline-atom

Would run the single test called atom-newline-atom.

Running the Benchmarks

Navigate to bench, and run tsx index.ts to see what commands are available. The script is able to benchmark a layout algorithm, running it repeatedly and reporting the mean running time. It can also generate the tables presented in the paper (two for error, and one for running time). There's also a layout command which runs one of the layout algorithms on an input file and produces an SVG image of the resulting layout.

The benchmark suite is composed of 6 source files which are hosted on GitHub. Here, they are listed along with the URL from which they were retrieved:

Dependencies

The below is a list of each dependency, and why each is required. There is one run-time dependency of the library:

  • @sbcohen/containers implements some useful container datastructures. In particular, we care about the IntervalTree.

The remaining dependencies are just needed for development:

  • jest is used for unit testing.
  • pixelmatch is used by the unit tests to check if two images have the same pixels, and if not, to generate a "diff" image.
  • sharp is used to convert SVGs to PNGs in tests.
  • ts-jest allows jest tests to be written in TypeScript as opposed to JavaScript.
  • tsx allows node to run TypeScript source files.
  • typescript is the TypeScript language compiler.

The demo program additionally depends on webpack and friends to generate a bundle.