Fetching contributors…
Cannot retrieve contributors at this time
109 lines (65 sloc) 2.79 KB

Grav Markdown RubyText Plugin

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


This plugin is easy to install with GPM.

$ bin/gpm install markdown-rubytext


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

enabled: true


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:


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:


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

  1. ISO 639-1 Language Codes List,


  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:

    active: true

Would activate the plugin.

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