(If this isn’t the right place to even ask this question, sorry!)
I’m wondering if <ruby>
is semantically appropriate to use for marking up things that aren’t related to languages. Specifically I’m thinking of phone numbers that use letters in place of numbers — the <ruby>
annotations could show the numerical equivalents of the letters.
Example: 1-800-FLOWERS, which is 1-800-356-9377 when dialed.
<p>1‒800‒<ruby>F<rt>3</rt>L<rt>5</rt>O<rt>6</rt>W<rt>9</rt>E<rt>3</rt>R<rt>7</rt>S<rt>7</rt></ruby></p>
That would render like this screenshot:
(Minor styling has been applied.)
The same effect could be achieved with <span>
s or whatever, but since <ruby>
is intended for annotating text, and because using it automatically comes with that styling applied, it might make sense to use it in this case.
Is <ruby>
's definition in the spec broad enough to cover this use case? If not, what markup would be better?
But if it is, then I suggest adding that information to the MDN page about <ruby>
, maybe as a “Hey, by the way…” aside.