jgm / djot

A light markup language
https://djot.net
MIT License
1.62k stars 43 forks source link

Syntax for ruby (<ruby>) #229

Open wisim3000 opened 1 year ago

wisim3000 commented 1 year ago

Hi, is it possible to support ruby in djot?

Which is like:

振り仮名ふりがな

Html:

<ruby>振り仮名<rt>ふりがな</rt></ruby>

In Japanese it seems common to display pronunciation with ruby (furigana), especially in light novels.

Also, in Chinese it has some usages on education.

But it should be rare in other languages.

So, should it be considered as a extension?

And I considered something like:

{# 振り仮名 | ふりがな} `

Or:

{#fg 振り仮名 | ふりがな}

`

bpj commented 1 year ago

Without speculating on how likely it is that there will be a dedicated syntax for ruby, while there isn't you could use something with classes and then use a filter to convert it into the right HTML; either nested spans

[😁[grin]{.rt}]{.rb}

or a verbatim and parse it with a regex:

`😁|grin`{.rb}

(A regex like ^([^|]+)\|(.+)$)