seanblue reports that when quoting HTML containing an empty <rt></rt> tag — used to indicate no furigana should appear above a character in Japanese ruby text — the empty tag is stripped, breaking the intended layout. For example, <ruby>振<rt>ふ</rt>り<rt></rt>仮<rt>が</rt>名<rt>な</rt></ruby> becomes <ruby>振<rt>ふ</rt>り仮<rt>が</rt>名<rt>な</rt></ruby>, causing furigana to misalign. Falco suggests using alternative valid HTML5 ruby syntax from the spec, such as <ruby><rb>振<rb>り<rb>仮<rb>名<rt>ふ<rt><rt>が<rt>な</ruby> or wrapping each character in its own <ruby> block, both of which quote correctly. seanblue acknowledges these work but notes they’re less common, and his Discourse plugin (based on markdown-it) follows the traditional <rt> pattern. He asks whether other empty HTML tags are preserved during quoting, as this issue affects plugin-generated content and manually written HTML alike.
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?
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.