Rendering modes
Annotating only hanja runs
Both Builder and SharedBuilder accept
.annotation_granularity(AnnotationGranularity::HanjaRun) independently of
.rendering(). With hangul-first parentheses, this writes 汽車길 as
기찻(汽車)길. In ruby mode, 半달形 puts separate glosses on 半 and 形.
The dictionary still supplies the reading for the whole word. If the unchanged
hangul does not identify a unique split, the renderer keeps the whole-word
gloss. AnnotationGranularity::Word is the default.
Low-level callers can use render_tokens_iter_with_granularity() or
ExpandingRenderer to receive multiple rendered tokens per annotation.
builder.rendering(mode) sets how hanja and their hangul readings appear in
the output.
RenderMode variants
RubyOnHangul and RubyOnHanja produce <ruby> markup; they are most
useful with HTML or Markdown output. In plain-text mode they fall back to
parentheses. The annotation is wrapped in <rp> (ruby parenthesis)
elements so that browsers without <ruby> support still render the reading
as a parenthesized gloss (한자(漢字)) rather than running it into the base
text.
Omitting dictionary-required hanja
Call .ignore_dictionary_required_hanja(true) on Builder or SharedBuilder
to skip hanja glosses requested only by a dictionary entry in
RenderMode::HangulOnly. This applies to bundled and custom dictionaries. It
leaves homophone glosses, explicit directives, and recognized source glosses
unchanged. The default is false.
options().ignore_dictionary_required_hanja reports the configured value.
For example, with RenderMode::Original this value can be true even though
options().ignores_dictionary_required_hanja() returns false and the output
is unaffected.
Original mode with a gloss style
RenderMode::Original keeps hanja in place and adds a gloss only for
homophones that need disambiguation. Use RenderOptions to also set the
gloss style:
Hanja variant sets
Variant recognition is always enabled. Builder::hanja_variant_set
independently chooses the spelling used whenever the renderer emits hanja:
The available profiles are AsDictionary (default), Shinjitai, Kanxi,
Simplified, and Asahimoji.