> For AI agents: the complete documentation index is available at https://canary.gukhanmun.org/ko-KR/llms.txt, the full documentation bundle is available at https://canary.gukhanmun.org/ko-KR/llms-full.txt.

# 렌더링 모드

한자와 그 한글 독음이 출력에 어떻게 나타날지 제어하려면 `load`의 `rendering`
옵션을 설정합니다.

## 사용 가능한 모드

| 값                       | 입력 | 출력                                               |
| ----------------------- | -- | ------------------------------------------------ |
| `"hangul-only"` (기본)    | 한자 | 한자                                               |
| `"hangul-hanja-parens"` | 한자 | 한자(漢字)                                           |
| `"hanja-hangul-parens"` | 한자 | 한자(漢字)                                           |
| `"ruby-on-hangul"`      | 한자 | `<ruby>한자<rp>(</rp><rt>漢字</rt><rp>)</rp></ruby>` |
| `"ruby-on-hanja"`       | 한자 | `<ruby>漢字<rp>(</rp><rt>한자</rt><rp>)</rp></ruby>` |
| `"original"`            | 한자 | 한자 (필요한 곳에 병기 추가)                                |

```ts twoslash
import { load } from "@gukhanmun/wasm";
import { stdictFst } from "@gukhanmun/stdict-fst";

const g = await load({
  rendering: "hangul-hanja-parens",
  dictionaries: [await stdictFst()],
});

console.log(g.convert("漢字"));  // 한자(漢字)
```

## 이체자 집합

이체자 인식은 언제나 활성화됩니다. 한자를 남기는 모드의 출력 표기만 바꾸려면
`hanjaVariantSet`를 설정합니다.

```ts twoslash
import { load } from "@gukhanmun/wasm";
// ---cut-before---
const g = await load({
  rendering: "original",
  hanjaVariantSet: "shinjitai",
});
```

값은 `"as-dictionary"`(기본), `"shinjitai"`, `"kanxi"`,
`"simplified"`, `"asahimoji"`입니다.

## 루비(ruby) 마크업

`"ruby-on-hangul"`과 `"ruby-on-hanja"`는 `<ruby>` 요소를 만듭니다.
`"text/html"`이나 `"text/markdown"` 형식과 함께 사용합니다. 평문 텍스트에서는
괄호를 씁니다. 주해(annotation)는 `<rp>`(ruby parenthesis) 요소로 감싸지므로,
`<ruby>`를 지원하지 않는 브라우저도 독음을 기저 텍스트에 섞지 않고 괄호로 묶인
병기(`한자(漢字)`)로 보입니다:

```ts twoslash
import { load } from "@gukhanmun/wasm";
import { stdictFst } from "@gukhanmun/stdict-fst";
// ---cut-before---
const g = await load({
  rendering: "ruby-on-hangul",
  dictionaries: [await stdictFst()],
});

console.log(g.convert("<p>漢字</p>", "text/html"));
// → <p><ruby>한자<rp>(</rp><rt>漢字</rt><rp>)</rp></ruby></p>
```

## 병기를 곁들인 Original 모드

구별이 필요한 곳에만 병기를 더하려면 `"original"`을 `originalGloss`와 함께
사용합니다:

```ts twoslash
import { load } from "@gukhanmun/wasm";
import { stdictFst } from "@gukhanmun/stdict-fst";
// ---cut-before---
const g = await load({
  rendering: "original",
  originalGloss: "parens",  // 또는 "ruby"
  dictionaries: [await stdictFst()],
});

console.log(g.convert("東京에서 東洋까지"));
// 同音異義語 倂記됨: 東京(동경)에서 東洋(동양)까지
```
