# markdown-it-ruby

> Ruby annotation plugin for markdown-it parser.

Latest version **1.1.2** (published 2024-11-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install markdown-it-ruby
pnpm add markdown-it-ruby
yarn add markdown-it-ruby
bun add markdown-it-ruby
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2024-11-28 |
| First published | 2017-09-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 20.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 36 |
| Author | Hiroshi Takase |
| Maintainers | lost_and_found |
| Keywords | markdown-it, markdown-it-plugin |

## Links

- npm: https://www.npmjs.com/package/markdown-it-ruby
- Repository: https://github.com/lostandfound/markdown-it-ruby
- Issues: https://github.com/lostandfound/markdown-it-ruby/issues
- npm.io page: https://npm.io/package/markdown-it-ruby

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 1.1.2 (latest) — 2024-11-28
- 1.1.1 — 2024-11-07
- 1.1.0 — 2024-10-26
- 1.0.0 — 2024-10-26
- 0.1.1 — 2017-09-29
- 0.1.0 — 2017-09-29

## README

# markdown-it-ruby

[![NPM version](https://img.shields.io/npm/v/markdown-it-ruby.svg?style=flat)](https://www.npmjs.org/package/markdown-it-ruby)

> Ruby annotations (`<ruby>`) tag plugin for [markdown-it](https://github.com/markdown-it/markdown-it) markdown parser.

`{ruby base|ruby text}` => `<ruby>ruby base<rt>ruby text</rt></ruby>`

Markup is based on [DenDenMarkdown](https://conv.denshochan.com/markdown) definition. 


## Install

```bash
npm install markdown-it-ruby --save
```

## Usage

### ESM (Recommended)
```js
import MarkdownIt from 'markdown-it';
import rubyPlugin from 'markdown-it-ruby';

const md = new MarkdownIt().use(rubyPlugin);
md.render('{ruby base|ruby text}'); // => '<p><ruby>ruby base<rt>ruby text</rt></ruby></p>'
```

### CommonJS
```js
const MarkdownIt = require('markdown-it');
const rubyPlugin = require('markdown-it-ruby');

const md = new MarkdownIt().use(rubyPlugin);
md.render('{ruby base|ruby text}'); // => '<p><ruby>ruby base<rt>ruby text</rt></ruby></p>'
```

### Options

You can pass options to the plugin:

```js
const md = new MarkdownIt().use(rubyPlugin, {
  rp: ['(', ')'] // Add parentheses around ruby text
});

// Output: <ruby>漢字<rp>(</rp><rt>かんじ</rt><rp>)</rp></ruby>
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. |

## License

[MIT](https://github.com/lostandfound/markdown-it-ruby/blob/master/LICENSE)

---
_Source: https://npm.io/package/markdown-it-ruby · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
