GitHub Pages compatible transcription templates (furigana) without plugins or JavaScript, Use only liquid template language.
无需 jekyll 插件或 JavaScript 实现的 GitHub Pages 注音效果,仅使用 liquid 模板语言
Want anchors next to your Jekyll headings without JavaScript or a plug-in?
Check out the sister project over at allejo/jekyll-anchor-headings allejo/jekyll-toc
- Download the
furigana.html
file from the master branch. - Move file to your
_includes
folder. - Like the code below, use this template:
{% include furigana.html text="漢字" furigana="かんじ" %}
{% include furigana.html text="漢,字" furigana="かん,じ" type="B" %}
{% include furigana.html text="测试" furigana="test" %}
{% include furigana.html text="测,试" furigana="cè,shì" type="B" %}
This snippet is highly customizable. Here are the available parameters to change the behavior of the snippet.
Parameter | Type | Default | Description |
---|---|---|---|
text |
string | "no_text" | Text in Kana or Chinese characters to be annotated |
furigana |
string | "no_furigana" | Hiragana, romanization or other transcription; shown above the Base text |
class |
string | "null" | a CSS class to the tag |
type |
string | "A" | single word single furigana |
when input "B": more word more furigana |
The performance impact of this code snippet on your website is negligible. The following statistics are from Jekyll's --profile
option.
| Filename | Count | Bytes | Time |
---------------------------------------------+-------+----------+--------
# A total of 732 Phonetic in Version 0.1.0
| _includes/furigana.html | 732 | 47.98K | 0.054 |
关于为什么使用 furigana,还是因为这个词语相对更普遍,当然不只是可以用作日本汉字的标注假名使用,各种音标也能使用。
This snippet may be redistributed under either the MIT licenses.