Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kiritaniayaka/markdown-it-ruby-parser

A simple ruby parser
https://github.com/kiritaniayaka/markdown-it-ruby-parser

Last synced: about 1 month ago
JSON representation

A simple ruby parser

Awesome Lists containing this project

README

        

# markdown-it-ruby-parser

[![npm Version Badge](https://img.shields.io/npm/v/markdown-it-ruby-parser.svg)](https://www.npmjs.com/package/markdown-it-ruby-parser)
![GitHub CI Status Badge](https://github.com/KiritaniAyaka/markdown-it-ruby-parser/workflows/CI/badge.svg)

Ruby tag plugin for `markdown-it`

# Usage

## Install

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

## Syntax

### Input

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

### Output

```html

砂すなの惑星わくせい


```

## Render

```javascript
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:

```typescript
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`.