This projet is an inspiration of helephant Gem.
The library is full compatible with Angular, and it's simple to use.
Source code can be found on my GitHub.
Compatible with all browsers.
npm install @clemox/ngx-furigana
- Declare service
import { NgxFuriganaService } from '@clemox/ngx-furigana';
constructor(
private furigana: NgxFuriganaService
) { }
- Call the service
The method "getReading" returns the input text.
// return 食[た]べ物[もの]が好きです
this.furigana.getReading('食[た]べ物[もの]が好きです');
The method "getExpression" returns the text without [...] hiragana.
// return 食べ物が好きです
this.furigana.getExpression('食[た]べ物[もの]が好きです');
The method "getHiragana" returns only the hiragana.
// return たべものが好きです
this.furigana.getExpression('食[た]べ物[もの]が好きです');
The method "getReadingHtml" returns only the RUBY HTML.
// return <ruby><rb>食</rb><rt>た</rt></ruby>べ<ruby><rb>物</rb><rt>もの</rt></ruby>が好きです
this.furigana.getReadingHtml('食[た]べ物[もの]が好きです');