# Quoting empty rt tags removes them

**URL:** https://meta.discourse.org/t/quoting-empty-rt-tags-removes-them/176290
**Category:** Support
**Created:** [January 16, 2021, 3:58pm UTC](https://meta.discourse.org/t/quoting-empty-rt-tags-removes-them/176290 "2021-01-16T15:58:15Z")
**Posts on this page:** 4
**Page:** 1

<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: [January 16, 2021, 3:58pm UTC](https://meta.discourse.org/t/quoting-empty-rt-tags-removes-them/176290/1 "2021-01-16T15:58:15Z")

</div>

Take the following HTML:  
`<ruby>振<rt>ふ</rt>り<rt></rt>仮<rt>が</rt>名<rt>な</rt></ruby>`

振ふり仮が名な

The empty `<rt></rt>` is very important here, as this is what results in proper placement of the furigana above each character. The empty `<rt></rt>` after り indicates to not place any furigana above this character. As you can see above, this works as expected.

However, when I quote that text (not full post quote), the resulting HTML is this:  
`<ruby>振<rt>ふ</rt>り仮<rt>が</rt>名<rt>な</rt></ruby>`

振ふり仮が名な

Because the empty `<rt></rt>` was removed, the が now appears above both り and 仮 instead of just above 仮 as in the original text. This is because it thinks the が is meant to be placed above all preceding characters since the last `rt` tag.

If possible, could you update quoting `rt` HTML tags so that they are copied over even when empty?

---

<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: [January 28, 2021, 11:22pm UTC](https://meta.discourse.org/t/quoting-empty-rt-tags-removes-them/176290/2 "2021-01-28T23:22:00Z")

</div>

Any thoughts on this?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [January 28, 2021, 11:41pm UTC](https://meta.discourse.org/t/quoting-empty-rt-tags-removes-them/176290/3 "2021-01-28T23:41:13Z")

</div>

On the [HTML5 Specification](https://www.w3.org/TR/html52/textlevel-semantics.html#the-ruby-element) I see examples using either:

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

 振り仮名 ふがな 

or

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

振ふり仮が名な

So I’d say to use either of the working forms present in the spec? The first one is even shorter to type!

---

<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: [January 29, 2021, 12:16am UTC](https://meta.discourse.org/t/quoting-empty-rt-tags-removes-them/176290/4 "2021-01-29T00:16:24Z")

</div>

It looks like the correct version of the first one would be:  
`<ruby><rb>振<rb><rt>ふ<rt>り<rb>仮<rb><rt>が<rb>名<rt>な</ruby>`

振ふり仮が名な

Compared to:  
`<ruby>振<rt>ふ</rt>り<rt></rt>仮<rt>が</rt>名<rt>な</rt></ruby>`

振ふり仮が名な

So about the same length. I’ve actually never seen the `rb` approach in the first one. I’m not sure if people generally use that version. It does quote correctly though. However, I’m still curious. Are there any other cases where empty HTML tags are copied over when quoting?

I build Discourse plugin wrapping an existing markdown-it plugin for ruby tags, and they follow the traditional `rt` approach instead of the `rb` + `rt` approach. Unfortunately, this means quoting in this one specific case would result in bad HTML. Obviously it can happen if people wrote the `ruby` HTML manually. I just happened to notice from the plugin.
