zfb

Type to search...

to open search from anywhere

Ruby annotations

Opt-in
CreatedJun 1, 2026Takeshi Takatsudo

Render ruby (furigana) annotations with the {base|ruby} syntax.

The ruby feature parses {base|ruby} inline syntax and renders it as <ruby><rb>base</rb><rt>ruby</rt></ruby> HTML — the standard markup for phonetic annotations such as Japanese furigana.

Enable

// zfb.config.ts
export default defineConfig({
  markdown: {
    features: {
      ruby: true,
    },
  },
});

Usage

Wrap the base text and its annotation in {...} separated by |:

{漢字|かんじ}を{学ぶ|まなぶ}

Renders as:

<ruby><rb>漢字</rb><rt>かんじ</rt></ruby><ruby><rb>学ぶ</rb><rt>まなぶ</rt></ruby>

Multiple annotations in one paragraph are supported. Annotations can appear anywhere inline — at the start, middle, or end of a sentence:

私は{東京|とうきょう}に住んでいます。

Edge cases

Inputs as authored in markdown (not in a table because the pipe in the ruby syntax collides with markdown table cell separators):

  • `{漢字|かんじ}`<ruby> element
  • `{|ruby}` (empty base) → left as literal text
  • `{base|}` (empty annotation) → left as literal text
  • `{text}` (no pipe) → left as literal text

Scope limitation — no auto-furigana

This feature only parses the explicit {base|ruby} syntax. It does not automatically detect kanji and add furigana through morphological analysis (e.g. kuromoji-style segmentation). Automatic furigana assignment is a separate, much harder problem that is intentionally out of scope.

If you need auto-furigana, a separate dedicated feature would be required.

Revision History