A markdown-it plugin to support Aozora Bunko style ruby syntax.
- Parses Aozora Bunko style ruby like below:
耳まで火照《ほて》って武州|青梅《おうめ》の宿
deno add jsr:@aiwas/markdown-it-aozora-rubyimport MarkdownIt from "markdown-it";
import aozoraRubyPlugin from "@aiwas/markdown-it-aozora-ruby";
const md = new MarkdownIt().use(aozoraRubyPlugin);
const html = md.render(
"これは青空文庫《あおぞらぶんこ》のルビ記法を使用するためのプラグインです。",
);
console.log(html);Output:
<p>これは<ruby>青空文庫<rp>(</rp><rt>あおぞらぶんこ</rt><rp>)</rp></ruby>のルビ記法を使用するためのプラグインです。</p>Currently, this plugin does NOT strictly support Aozora Bunko notation.
Aozora Bunko displays ruby characters for alphabets separated by spaces, but in
this plugin, characters other than kanji must always be separated by the "|"
symbol.
For example, no ruby will be rendered for
この Markdown《マークダウン》 形式は便利だ。 (that has space before an
alphabet word and after the '》' symbol, Aozora Bunko's intended format).