Rendering modes
rendering controls how a recognized word and its reading appear. The table
shows 漢字 with a dictionary reading of 한자, without homophone or directive
marks:
Ruby markup
Ruby modes produce <ruby> elements in HTML and Markdown where inline markup
is allowed. In plain text, and in text-only HTML elements such as <title>
and <option>, they fall back to parentheses.
RUBY_ON_HANGUL uses hangul as the base and hanja inside <rt> instead.
The <rp> elements provide parentheses for browsers without ruby support.
Annotating only hanja runs
Pass annotation_granularity=AnnotationGranularity.HANJA_RUN to
Converter() independently of rendering. For example, in
RenderMode.HANGUL_HANJA_PARENS mode, 汽車길 becomes 기찻(汽車)길.
AnnotationGranularity.WORD is the default and remains the fallback when
the selected reading cannot be split uniquely. The resolved choice is
available at converter.options.annotation_granularity.
Omitting dictionary-required hanja
Pass ignore_dictionary_required_hanja=True to Converter() to omit hanja
glosses required only by dictionary entries in RenderMode.HANGUL_ONLY.
The default is False. Homophone glosses, explicit directives, and recognized
source glosses are unchanged. Read the configured value from
converter.options.ignore_dictionary_required_hanja.
Original text with a gloss
ORIGINAL keeps hanja and adds a reading when an annotation carries a
require_hangul mark. Homophone disambiguation alone does not add a reading
in this mode.
original_gloss chooses parentheses or ruby for those readings:
OriginalGloss.PARENS is the default. original_gloss affects only
RenderMode.ORIGINAL; it does not select the main rendering mode.
Hanja variant sets
A hanja character can have several variant spellings. Recognition of supported
variants is always enabled. hanja_variant_set controls the
spelling emitted after recognition by modes that retain hanja; it does not
choose a dictionary or a reading.