Skip to main content

Day 75 of 100DaysOfSpec, mark, ruby, rb, rt, rtc, and rp elements

I am reading and taking notes on the HTML specifications for 100 days as part of #The100DayProject. Read the initial intent/backstory. I am a Microsoft employee but all opinions, comments, etc on this site are my own. I do not speak on behalf of my employer, and thus no comments should be taken as representative of Microsoft's official opinion of the spec. Subsections not listed below were read without comment.

Currently reading in 4.5 Text-level semantics.

Fun fact: I have never used any of the elements in today’s reading.

4.5.20 The mark element

“The mark element represents a run of text in one document marked or highlighted for reference purposes, due to its relevance in another context.”

  • Semantics inside a quotation: the HTML author is highlighting some text to give it more attention than the original source (“emphasis my own” type of deal).
  • Semantics in main body content: highlighted text is relevant to the “user’s current activity”. I figured this would probably be text that changes given some interaction, and similarly the example in the spec is highlighting on text that matches an in-page search term.
  • The strong element is for emphasis; the mark element is for relevance. A subtle difference.

4.5.21 The ruby element

“The ruby element allows one or more spans of phrasing content to be marked with ruby annotations.”

So…I was a bit confused at first because I thought this was referring to Ruby the programming language. Huh? Why does this particular programming language get its own element? But, oh:

“Ruby annotations are short runs of text presented alongside base text, primarily used in East Asian typography as a guide for pronunciation or to include other annotations. In Japanese, this form of typography is also known as furigana.”

Got it.

Which is fun because the programming language was created by Japanese developer Yukihiro "Matz" Matsumoto. I suppose one could imply this is where the name comes from, but it doesn’t necessarily seem that way from a quick Wikipedia peek.

Anyway. This whole section is completely new to me and I’m not sure how to share notes without just rewriting the spec, so I’m going to take the cop-out method here and link back to this section of the spec.

4.5.22 The rb element

One of the things that melted my brain in that last section on ruby was the omission of closing tags. It is ok to omit the end tag of rb if the element is “immediately followed by an rb, rt, rtc or rp element, or if there is no more content in the parent element.” Same general concept applies to rt, rtc or rp elements.

As for the definition: “the rb element marks the base text component of a ruby annotation.”

This element doesn’t have any semantic meaning on its own: it helps a parent ruby element decide what said ruby element represents. If that parent doesn’t exist, the rb’s representation is the same as its contents. Same general concept applies to rt, rtc or rp elements.

4.5.23 The rt element

“The rt element marks the ruby text component of a ruby annotation.” The bits that give notation about the main rb text.

4.5.24 The rtc element

“The rtc element marks a ruby text container for ruby text components in a ruby annotation.”

The rtc element can be used for processing categorization of a ruby element’s content.

4.5.25 The rp element

“The rp element is used to provide fallback text to be shown by user agents that don't support ruby annotations.”

  • Has to come immediately before or after an rt or rtc, but can’t be jammed between two rt elements.
  • People often use the content of this element to put parentheses around the ruby text (rt elements), that bit which gives notation to the main text of the ruby element.

Responses

My blog uses Webmentions. Responses from Mastodon and other sites that send Webmentions will show up here.

No Webmentions have been sent to this post yet.