> 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.

# 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.

```sh
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:

```sh
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.

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

### `hangul-hanja-parens`

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

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

### `hanja-hangul-parens`

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

```sh
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:

| Value           | Policy                                         |
| --------------- | ---------------------------------------------- |
| `as-dictionary` | Keep the matched dictionary spelling.          |
| `shinjitai`     | Use Japanese Joyo kanji new forms.             |
| `kanxi`         | Prefer compatibility-folded traditional forms. |
| `simplified`    | Use Unicode simplified variants.               |
| `asahimoji`     | Use shinjitai plus the verified Asahi set.     |

```sh
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.

```sh
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.

```sh
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-gloss` | Output                                           |
| ------------------ | ------------------------------------------------ |
| `parens`           | 漢字(한자)                                           |
| `ruby`             | `<ruby>漢字<rp>(</rp><rt>한자</rt><rp>)</rp></ruby>` |

```sh
echo "漢字" | gukhanmun --rendering original --original-gloss parens
# → 漢字(한자)
```
