rubyann is a javascript library that uses a simple custom-syntax to create ruby annotations (eg furigana)
npm install rubyannRubyAnn
--------
*(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:
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 '
If you want to clone and build RubyAnn yourself you'll need:
#### 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