# Inline language markup? (language learning site)

**URL:** https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582
**Category:** Feature
**Created:** [2017年五月29日 22:13 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582 "2017-05-29T22:13:21Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![rfindley](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rfindley/32/71814_2.png) [@rfindley](https://meta.discourse.org/u/rfindley)
#### Post date: [2017年五月29日 22:13 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/1 "2017-05-29T22:13:21Z")

</div>

Is there enough interest in the community to merit adding inline markup for language?  
This is would be helpful in mixed language communities, and especially language learning forums.

For example, something like this:

> [lang=ja]…[/lang]

To produce html:

> \<span lang=“ja”\>…\</span\>

The same Unicode character is rendered differently in different languages:

![](https://global.discourse-cdn.com/meta/original/3X/8/7/8775dbe9526d03682e09a046771664aa35041c4c.png)

In the image above, the browser renders it differently when it knows the text is Japanese.

I realize there are site-wide and user-specific locale settings, but in a mixed-language post (like on a language learning site), two languages could be used in the same post.

Is this worthy of mainline integration?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2017年五月30日 16:57 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/2 "2017-05-30T16:57:03Z")

</div>

Very interesting, I wonder if we should simply whitelist `<span lang="ja">` in core, it seems pretty low risk.

Not sure about the general interest here, this is the first time I have seen this request come up, but totally get that mixed Chinese / Japanese communities exist and they surely need this feature.

---

<div class="post-metadata">

### Author: ![rfindley](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rfindley/32/71814_2.png) [@rfindley](https://meta.discourse.org/u/rfindley)
#### Post date: [2017年五月30日 17:41 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/3 "2017-05-30T17:41:18Z")

</div>

That’s certainly a simpler solution.  
I guess I would lean toward whitelisting the lang attribute on all Discourse-supported html tags, since the html standard allows it on all html tags.

---

<div class="post-metadata">

### Author: ![rfindley](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rfindley/32/71814_2.png) [@rfindley](https://meta.discourse.org/u/rfindley)
#### Post date: [2017年七月10日 20:55 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/4 "2017-07-10T20:55:36Z")

</div>

One other tag set worth whitelisting is ‘ruby’ tags, which are a standard part of html for Japanese language support.

Since there are thousands of kanji (e.g. 漢字) in the Japanese language, Japanese students are still learning them all the way through high school. So, it is common for publications to use “furigana” to mark the pronunciation above kanji (see snapshot below from NHK News website).

 ![](https://global.discourse-cdn.com/meta/original/3X/0/a/0ad3166b4be05de3c77e9bb4ed9a7d499ce2c762.png)

The [W3C](https://www.w3.org/TR/ruby/) site has the following for a complete list of ruby tags:

```html
<ruby> </ruby>
<rbc> </rbc>
<rtc> </rtc>
<rb> </rb>
<rc> </rc>
<rp> </rp>

```

I can’t think of any risks to whitelisting, since they’re pretty straight foward.

Here’s an example of html and result (as an image):

```html
<ruby><rb>漢字</rb><rt>かんじ</rt></ruby>

```

![](https://global.discourse-cdn.com/meta/original/3X/5/0/5001ca4976f8ffb8ecb7233f663c2c12566b333f.png)

(Looks like font size might need to be set to 1.2em, as I’ve done in the sample text above)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2017年七月10日 20:59 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/5 "2017-07-10T20:59:52Z")

</div>

Be sure to mention that here:

> **[Proper ruby text () syntax support in Markdown](https://talk.commonmark.org/t/proper-ruby-text-rb-syntax-support-in-markdown/2279)**
>
> It is fairly common for East Asian languages (mostly CJK characters) to have ruby texts annotations; not only do they provide phonetic guides, the actual meaning of text might even differ without labeling. This technique is currently implemented...

@codinghorror what is your call here

- Whitelist `<span lang>` in core and ruby tags (not the Ruby language its a Japanese feature)

or

- Add a site setting for the whitelisting

---

<div class="post-metadata">

### Author: ![rfindley](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rfindley/32/71814_2.png) [@rfindley](https://meta.discourse.org/u/rfindley)
#### Post date: [2017年七月10日 21:00 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/6 "2017-07-10T21:00:28Z")

</div>

Yep.. We’ve got a few other people working on mentioning it at CommonMark.  
Thanks!!

---

<div class="post-metadata">

### Author: ![rfindley](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rfindley/32/71814_2.png) [@rfindley](https://meta.discourse.org/u/rfindley)
#### Post date: [2017年七月10日 23:01 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/8 "2017-07-10T23:01:44Z")

</div>

FYI,

I did some testing, and there are side-effects if `<ruby>` is allowed in thread titles. Post body seems fine, though.

I suppose CSS could hide them in thread titles. That seemed to work fine in tests.  
Without additional research, I’m not sure how important it is to support `<ruby>` in titles. But I do feel like it would be a big boost for the message body.

Anyway, here are some samples (randomly inserted text):

 ![](https://global.discourse-cdn.com/meta/original/3X/0/d/0dca0ba72a4b2fd8679078956039c77ac9b7af6b.png)

* * *

and this:

 ![](https://global.discourse-cdn.com/meta/original/3X/8/6/8681b8c475fb95f3b2e1add20a8e3ef4da61400e.png)

* * *

Body text works fine, since line-height isn’t forced:

* * *

![](https://global.discourse-cdn.com/meta/original/3X/7/a/7ac4210f1ebf03c7da76bc69a8a10d3d74a455e9.png)

* * *

---

<div class="post-metadata">

### Author: ![seanblue](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@seanblue](https://meta.discourse.org/u/seanblue)
#### Post date: [2018年七月5日 19:56 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/9 "2018-07-05T19:56:44Z")

</div>

I know it’s been a year since this topic was created, but is there any update on whether ruby tags will be whitelisted?

---

<div class="post-metadata">

### Author: ![kyrias](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kyrias/32/85207_2.png) [@kyrias](https://meta.discourse.org/u/kyrias)
#### Post date: [2018年七月26日 16:59 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/10 "2018-07-26T16:59:23Z")

</div>

Any updates on the `lang` attribute whitelisting? Been having some annoyances today with not being able to mark text up properly.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018年七月27日 00:17 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/11 "2018-07-27T00:17:05Z")

</div>

Sure I can add a whitelist in core for lang on spans, do you need it on divs as well?

---

<div class="post-metadata">

### Author: ![kyrias](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kyrias/32/85207_2.png) [@kyrias](https://meta.discourse.org/u/kyrias)
#### Post date: [2018年七月27日 15:04 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/12 "2018-07-27T15:04:29Z")

</div>

`<span>`, `<p>`, and `<div>` would all be reasonable to have it whitelisted for, hm.

---

<div class="post-metadata">

### Author: ![kyrias](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kyrias/32/85207_2.png) [@kyrias](https://meta.discourse.org/u/kyrias)
#### Post date: [2018年七月27日 15:05 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/13 "2018-07-27T15:05:36Z")

</div>

Technically `<a>` tags too, but for that you could have a `<span>` to mark up the link text, so it’s not as important I think.

---

<div class="post-metadata">

### Author: ![rfindley](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rfindley/32/71814_2.png) [@rfindley](https://meta.discourse.org/u/rfindley)
#### Post date: [2018年七月27日 15:46 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/14 "2018-07-27T15:46:04Z")

</div>

Since ‘lang’ is a global attribute, I would be inclined to whitelist it on any Discourse-supported tags… but I don’t know what the implications of that would be for Discourse’s filtering efficiency.

If there’s good reason for keeping the whitelisting to a minimum, it would still be helpful to support at least one block-level element (e.g. `<div>`) and one inline element (e.g. `<span>`).

---

<div class="post-metadata">

### Author: ![seanblue](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@seanblue](https://meta.discourse.org/u/seanblue)
#### Post date: [2018年七月29日 22:43 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/16 "2018-07-29T22:43:59Z")

</div>

But still no word on the ruby tags?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018年八月2日 06:47 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/17 "2018-08-02T06:47:50Z")

</div>

Happy to white list them just need details of exactly what needs whitelisting.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018年八月2日 06:53 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/18 "2018-08-02T06:53:51Z")

</div>

lang is whitelisted per:

[https://github.com/discourse/discourse/commit/0b3d51a8bc43391b3f64719c6606ff3298128824](https://github.com/discourse/discourse/commit/0b3d51a8bc43391b3f64719c6606ff3298128824)

---

<div class="post-metadata">

### Author: ![rfindley](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rfindley/32/71814_2.png) [@rfindley](https://meta.discourse.org/u/rfindley)
#### Post date: [2018年八月2日 08:04 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/19 "2018-08-02T08:04:35Z")

</div>

> [@sam](#):
>
> [re: ruby tags…]  
> Happy to white list them just need details of exactly what needs whitelisting.

`<ruby>`, `<rb>`, `<rt>`, and `<rp>`  
And the `[lang]` attribute on `<ruby>`, `<rb>`, and `<rt>`  
(`<rp>` is just for enclosing parenthesis as a fallback for old browsers, so `[lang]` isn’t useful.)

Based on the tests I ran [above](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/4), I’d recommend only whitelisting them in the post body, not in titles. It would cause layout problems in titles, but is okay in the post body.

Also, a slightly increased font size makes quite a bit of difference for readability:

before:  
 ![image](https://global.discourse-cdn.com/meta/original/3X/1/9/1961d2e5c7993604b9387b0e06767e05ca090758.png) ![image](https://global.discourse-cdn.com/meta/original/3X/9/1/918541c5e09b8a816d86ef39cfac41ef921a6d17.png)  
after:  
 ![image](https://global.discourse-cdn.com/meta/original/3X/3/f/3f0964ee40fd2b6a8aec582e2e811527cfaddbd4.png) ![image](https://global.discourse-cdn.com/meta/original/3X/f/9/f9c71e86e60a2e1ae26012210cfef320e2486750.png)

```javascript
ruby {
    font-size: 16px; /* default is 14px from css on 'html' in base.scss */
}
rt {
    font-size: 10px; /* default is 50% in Chrome */
}

```

---

<div class="post-metadata">

### Author: ![rfindley](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rfindley/32/71814_2.png) [@rfindley](https://meta.discourse.org/u/rfindley)
#### Post date: [2018年八月2日 08:18 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/20 "2018-08-02T08:18:43Z")

</div>

Oops… I had a few typos above with `<rp>` and `<rb>`. It’s corrected now.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018年八月3日 01:50 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/21 "2018-08-03T01:50:23Z")

</div>

This is now done per, [FEATURE: allow ruby tags in Markdown · discourse/discourse@280c318 · GitHub](https://github.com/discourse/discourse/commit/280c318c49e862d4226ffee48134413ca84dcd85)

@awesomerobot do you want to add some basic styling here? We can not have the px based rules but something out-of-the-box would be nice for CJK communities.

Read all about Ruby tags here..

> **[Ruby character](https://en.wikipedia.org/wiki/Ruby_character)**
>
> Ruby characters or rubi characters (Japanese: ルビ; rōmaji: rubi; Korean: 루비; romaja: rubi) are small, annotative glosses that are usually placed above or to the right of logographic characters of languages in the East Asian cultural sphere, such as Chinese hanzi, Japanese kanji, and Korean hanja, to show the logographs' pronunciation; these were formerly also used for Vietnamese chữ Hán and chữ Nôm, and may still occasionally be seen in that context when reading archaic texts. Typically called jus...

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [2018年八月3日 17:56 UTC](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582/23 "2018-08-03T17:56:44Z")

</div>

I made an update to increase the `rt` font-size from 50% to 72%, which is approximately 10px (based on our default 14px font size).

![41%20PM](https://global.discourse-cdn.com/meta/original/3X/0/5/051ce5224d1be706e2b1032aaccbe69f68d73c1a.png)

The font-size in the ruby tag is based off of our base font-size for all content, so it seems like that should be increased along with all site or post text and not on its own.

[下一頁](https://meta.discourse.org/t/inline-language-markup-language-learning-site/63582.md?page=2)
