For AI agents: the complete documentation index is available at https://canary.gukhanmun.org/llms.txt, the full documentation bundle is available at https://canary.gukhanmun.org/llms-full.txt, and this page is available as Markdown at https://canary.gukhanmun.org/guide/cli/rendering.md.

Rendering modes

--rendering controls how hanja and their hangul readings appear in the output. The default is hangul-only.

Omitting dictionary-required hanja

Pass --ignore-dictionary-required-hanja to omit hanja glosses required only by dictionary entries in hangul-only output. Homophone glosses, explicit directives, and recognized source glosses are unchanged. Other rendering modes accept the flag without changing their output.

printf '%s\n' '憂鬱症' |
  gukhanmun -r hangul-only --disambiguation off --ignore-dictionary-required-hanja

With the bundled Standard Korean Dictionary, this prints 우울증.

Annotating only hanja runs

Pass --annotation-granularity hanja-run to attach each gloss to its contiguous hanja run rather than to the whole word:

printf '%s\n' '汽車길' |
  gukhanmun -r hangul-hanja-parens --annotation-granularity hanja-run
# → 기찻(汽車)길

word is the default. The renderer also keeps the whole-word gloss if the reading cannot be split uniquely. The option does not turn on glosses that --rendering would otherwise omit. Ruby also uses run boundaries, with parentheses where inline markup is unavailable. The CLI's Markdown formatter can still strip inline HTML, including ruby, from headings.

Available modes

hangul-only (default)

Replaces each hanja word with its hangul reading. The original hanja is discarded.

echo "漢字" | gukhanmun --rendering hangul-only
# → 한자

hangul-hanja-parens

Outputs the hangul reading followed by the original hanja in parentheses.

echo "漢字" | gukhanmun --rendering hangul-hanja-parens
# → 한자(漢字)

hanja-hangul-parens

Outputs the original hanja followed by the hangul reading in parentheses.

echo "漢字" | gukhanmun --rendering hanja-hangul-parens
# → 漢字(한자)

Hanja variant sets

Recognition accepts supported traditional, simplified, Japanese, Asahi, and CJK compatibility forms regardless of this setting. --hanja-variant-set controls only the spelling emitted when a rendering mode keeps hanja:

ValuePolicy
as-dictionaryKeep the matched dictionary spelling.
shinjitaiUse Japanese Joyo kanji new forms.
kanxiPrefer compatibility-folded traditional forms.
simplifiedUse Unicode simplified variants.
asahimojiUse shinjitai plus the verified Asahi set.
echo "藝術" | gukhanmun --rendering original --hanja-variant-set shinjitai
# → 芸術

ruby-on-hangul

Wraps the hangul reading in a <ruby> element with the hanja as the annotation. Requires HTML or Markdown output (-f text/html or -f text/markdown); in plain text falls back to parentheses.

echo "漢字" | gukhanmun -f text/html --rendering ruby-on-hangul
# → <ruby>한자<rp>(</rp><rt>漢字</rt><rp>)</rp></ruby>

The <rp> elements hold parenthesized fallback text. Browsers that support <ruby> hide them and stack the annotation above the base, while browsers without <ruby> support display the gloss in parentheses (한자(漢字)) instead of running it into the base text.

ruby-on-hanja

Wraps the original hanja in a <ruby> element with the hangul reading as the annotation.

echo "漢字" | gukhanmun -f text/html --rendering ruby-on-hanja
# → <ruby>漢字<rp>(</rp><rt>한자</rt><rp>)</rp></ruby>

original

Keeps the original hanja in the output and adds a gloss only where needed to disambiguate homophones. Use --original-gloss to choose the gloss style:

--original-glossOutput
parens漢字(한자)
ruby<ruby>漢字<rp>(</rp><rt>한자</rt><rp>)</rp></ruby>
echo "漢字" | gukhanmun --rendering original --original-gloss parens
# → 漢字(한자)