Ruby tag plugin for markdown-it
npm install markdown-it-ruby-parser
# or
yarn add markdown-it-ruby-parser
# or
pnpm add markdown-it-ruby-parser[砂]^(すな)の[惑星]^(わくせい)<p><ruby>砂<rt>すな</rt></ruby>の<ruby>惑星<rt>わくせい</rt></ruby></p>const md = require('markdown-it')()
const rubyParser = require('markdown-it-ruby-parser')
// using this plugin
md.use(rubyParser)
md.render('What you want to render')Config definition:
interface RubyParserOptions {
bracket?: BracketStyle
rb?: boolean
rp?: boolean
}
type BracketStyle = '(' | '{'You can use ( or { style:
[砂]^(すな)の[惑星]^(わくせい) or [砂]^{すな}の[惑星]^{わくせい}
Default: (
Enable rb tag
This configuration decide whether the content of rendering has rb tag.
Default: true
Enable rp tag
This configuration decide whether the content of rendering has rp tag.
Default: true
The configurations above has covered in test case, you can view in /test/MainTest.test.ts.