markdown-it-ruby-parser
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

markdown-it-ruby-parser

npm Version Badge GitHub CI Status Badge

Ruby tag plugin for markdown-it

Usage

Install

npm install markdown-it-ruby-parser
# or
yarn add markdown-it-ruby-parser
# or
pnpm add markdown-it-ruby-parser

Syntax

Input

[]^(すな)の[惑星]^(わくせい)

Output

<p><ruby><rt>すな</rt></ruby><ruby>惑星<rt>わくせい</rt></ruby></p>

Render

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

Config definition:

interface RubyParserOptions {
	bracket?: BracketStyle
	rb?: boolean
	rp?: boolean
}

type BracketStyle = '(' | '{'

BracketStyle

You can use ( or { style:

[砂]^(すな)の[惑星]^(わくせい) or [砂]^{すな}の[惑星]^{わくせい}

Default: (

rb

Enable rb tag

This configuration decide whether the content of rendering has rb tag.

Default: true

rp

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.

Package Sidebar

Install

npm i markdown-it-ruby-parser

Weekly Downloads

1

Version

0.1.1

License

MIT

Unpacked Size

6.52 kB

Total Files

4

Last publish

Collaborators

  • kiritaniayaka