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

ink-blotter

v0.5.0

Published

An engine for displaying Ink stories in the browser, using InkJS

Downloads

18

Readme

Blotter

Blotter is a a front-end engine for publishing Ink stories on the web. It uses inkjs as its core Ink engine and sole dependency for a pure JavaScript implementation of a simple user interface.

Currently, Blotter is a proof-of-concept project. See gall for a turnkey way of using Blotter in a project.

Usage

As a standalone js file

Use Gall. This information is provided mostly for documentation purposes.

If not using Gall, get the bundled Blotter file from the repository or npm and inline or include it at the end of your html page's body. The page should contain the following structure in its body:

  • body
    • div#content-container
      • div#story-stage
      • div#choices

You will also need a CSS that at the very least applies certain transitions and animations to content elements, since Blotter uses CSS animations to time itself when inserting content into the page. See the Gall scaffold for a Less file with examples of how this should work.

The other thing you need is to inline the compiled json from your ink story, output by inklecate, into the head of the html file. You need a <script type="application/json" id="storyscript"> tag. Blotter looks for those specific attributes.

Blotter attaches two things to the global window object: story is the actual Inkjs story object, and can be used to attach events to variable changes within Ink or implement game saving/loading. blotterStart is a function that, when called, starts the main blotter UI loop.

As an npm module

You can also use your own bundling/build system (such as browserify, webpack, or brunch) to assemble apps with blotter. In that case, you can install blotter from npm as usual, and then in your main script: const blotter = require('blotter'). blotter.start() starts the main UI loop; blotter.story is a reference to the Ink story object.

Additional features

Blotter interprets underscore characters as signaling emphasis and strong in the same way as markdown. Note that it will only read them on word boundaries. It will also automagically turn ' and " characters into smart "curly" quotes. A hyphen (-) surrounded by spaces will be converted into an en dash; two hyphens into an em dash. Following the most common usage conventions, en dashes are spaced, while em dashes are not.

Blotter has some inherent support for Ink tags. Tags surrounded by angle brackets, like <h1> or <h3> will be rendered as that html element, instead of a normal paragraph <p>. Tags that start with a dot, like .red or .emphasis will apply that class to the element, making it possible to style it.

Paragraphs starting with h1 will be rendered as h1 header elements; the same is true of h2, h3, h4, h5, and h6. This feature is deprecated and might be removed entirely in a future release.