Ruby annotation plugin for markdown-it parser.
npm install markdown-it-ruby
> Ruby annotations () tag plugin for markdown-it markdown parser.
{ruby base|ruby text} => ruby base
Markup is based on DenDenMarkdown definition.
``bash`
npm install markdown-it-ruby --save
js
import MarkdownIt from 'markdown-it';
import rubyPlugin from 'markdown-it-ruby';const md = new MarkdownIt().use(rubyPlugin);
md.render('{ruby base|ruby text}'); // => '
ruby base
'
`$3
`js
const MarkdownIt = require('markdown-it');
const rubyPlugin = require('markdown-it-ruby');const md = new MarkdownIt().use(rubyPlugin);
md.render('{ruby base|ruby text}'); // => '
ruby base
'
`$3
You can pass options to the plugin:
`js
const md = new MarkdownIt().use(rubyPlugin, {
rp: ['(', ')'] // Add parentheses around ruby text
});// Output: 漢字
md.render('{漢字|かんじ}');
`#### Available Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
|
rp | [string, string] | ['', ''] | Array of opening and closing parentheses to wrap around ruby text. When both values are empty strings, no rp` elements will be output. |