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

rubyann

v3.0.2

Published

rubyann is a javascript library that uses a simple custom-syntax to create ruby annotations (eg furigana)

Downloads

10

Readme

RubyAnn

(see also the original jQuery version jquery.rubyann)

rubyann is a small library for writing ruby annotations using a simplified syntax. Basically, to avoid writing the tedious XML required. This is most often used for Japanese furigana.

For most users, this will simply mean - a convenient way of adding Furigana to their Kanji in a web page.

Example

It works by using the custom syntax below:

{日,に}{本,ほん}{語,ご}

ie {kanji,furigana} any text here

rubyann will parse this and can replace the HTML with ruby annotations that looks like this:

RubyAnn result

This is done by using rubyann in javascript like this:

  let ann = new RubyAnn()
  ann.elements('.furigana-text')

You can also pass in your own delimiters (instead of curly braces) - incase there's a conflict

eg new RubyAnn('[]') - the function/constructor takes 2 characters in a string for start/end.

Another use of the library is to just get the raw XML/XHTML, without affecting the DOM, to use however you need.

  let ann = new RubyAnn()
  ann.getXml('{鳥,とり}')   // returns '<ruby><rb>鳥</rb><rp>(</rp><rt>とり</rt><rp>)</rp></ruby>'

Source Code

RubyAnn is written in TypeScript and has a Mocha test suite and a Demo Page that can be run locally.

Build

Requirements

If you want to clone and build RubyAnn yourself you'll need:

NodeJS

Tasks

npm install or yarn - installs the (NPM) dependencies (yarn is highly recommended)

npm run release or yarn release - transpiles the TypeScript source and minifies the javascript to 'dist' directory

npm run test or yarn test - transpiles and runs the test suite