That is, the word or character which needs text above it is wrapped in <ruby>. The pronunciation is wrapped in <rt>. The <rp> element indicates the presence of a parenthesis - which isn't usually displayed, but will be shown if the browser doesn't support <ruby> syntax.
That's fairly easy for scripts written left-to-right. But how does it work for scripts like Arabic where the text is written right-to-left, but the user may want the pronunciations left-to-right?
Let's take the phrase "Hello World" in Arabic: مرحبا بالعالم . Google Translate tells me this is pronounced "marhaban bialealami".
For a single word, the directionality can be ignored. The browser should be smart enough to place the pronunciation above the word:
The first is to write each word separately. For example <ruby>1st word</ruby> <ruby>2nd word</ruby>. Obviously, this isn't normally how you'd write a RTL language! But it does work: