The markdown-rubytext plugin for Grav allows you to add output <ruby> tag text in Markdown
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
CHANGELOG.md
LICENSE
README.md
blueprints.yaml
markdown-rubytext.php
markdown-rubytext.yaml
markdown-rubytext3-0-0.png
markdown-rubytext3-0-0_2.png
markdown-rubytext3-0-0_3.png

README.md

Grav Markdown RubyText Plugin

The markdown-rubytext plugin for Grav allows you to add output tagged text in Markdown:

Installation

This plugin is easy to install with GPM.

$ bin/gpm install markdown-rubytext

Configuration

Simply copy the user/plugins/markdown-color/markdown-rubytext.yaml into user/config/plugins/markdown-rubytext.yaml and make your modifications.

enabled: true

Usage

simple and serial ruby

In your markdown file, thoses shortcodes:

This is {r}日(に)本(ほん)語(ご){/r}
and this is {r}漢(ㄏㄢˋ){/r}.

Will produce the following HTML:

This is <ruby>日<rp>(</rp><rt>に</rt><rp>)</rp>本<rp>(</rp><rt>ほん</rt><rp>)</rp>語<rp>(</rp><rt>ご</rt><rp>)</rp></ruby> 
and this is <ruby>漢<rp>(</rp><rt>ㄏㄢˋ</rt><rp>)</rp></ruby>.

Standart display:

this-is-nihongo-and-this-is-kan

new option (from v3.0.0): possiblity add a lang attributes

In your markdown file, it is now also possible to set lang attributes like:

This is {r=ja/ar}メダウルッシュ(مداوروش){/r},

this is {r=ja/fr}ピエル(Pierre)・()グリマル(GRIMAL){/r},

this is {r=ja/grc}トロイア(Τρωάς){/r},

this is {r}漢(ㄏㄢˋ){/r},

and this is {r=ja/ber}アマーズィーグ(ⴰⵎⴰⵣⵉⵖ){/r}族.

Will produce the following HTML, nested by a single ruby HTML tag:

This is <ruby lang="ja">メダウルッシュ<rp>(</rp><rt lang="ar">مداوروش</rt><rp>)</rp></ruby>, 

this is <ruby lang="ja">ピエル<rp>(</rp><rt lang="fr">Pierre</rt><rp>)</rp>・<rp>(</rp><rt lang="fr"></rt><rp>)</rp><rb>グリマル<rp>(</rp><rt lang="fr">GRIMAL</rt><rp>)</rp></ruby>,

this is <ruby lang="ja">トロイア<rp>(</rp><rt lang="grc">Τρωάς</rt><rp>)</rp></ruby>,

this is <ruby>漢<rp>(</rp><rt>ㄏㄢˋ</rt><rp>)</rp></ruby>,

and this is <ruby lang="ja">アマーズィーグ<rp>(</rp><rt lang="ber">ⴰⵎⴰⵣⵉⵖ</rt><rp>)</rp></ruby>.

Standart display:

this-is-nihongo-and-this-is-kan

to be valid HTML, lang attributes has to be part of:

  1. ISO 639-1 Language Codes List,

OR

  1. ISO 639-2 Language Codes List

Important note:

To be valid, each lang attribute has to be of 2 or 3 letters maximum.

Future goal (difficult, please contribute)

add possibility to enabled from page

In your config file:

enabled: true
active: false

In your markdown file:

markdown-rubytext:
    active: true

Would activate the plugin.

A example can be found with the shortcode-core plugin here.