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

# 지시

`Directives`는 선택된 독음을 어떻게 표시할지 조정합니다. 사전 항목을
추가하거나 다른 독음을 선택하지는 않습니다. 세 시퀀스(sequence)에는
글로브(glob) 패턴이나 Python 콜백(callback) 대신 리터럴(literal) 한자 표기를
넣습니다.

```python
from gukhanmun import Converter, DictionaryEntry, Directives, MapDictionarySource

converter = Converter(
    dictionaries=[MapDictionarySource([DictionaryEntry("漢字", "한자")])],
    directives=Directives(require_hanja=["漢字"]),
)
assert converter.convert("漢字") == "한자(漢字)"
```

규칙은 변환 주해(annotation)에 적용됩니다. 용어가 하나의 단위로 인식되어야
한다면 그 용어 전체를 [사전](https://canary.gukhanmun.org/ko-KR/guide/python/dictionaries.md)에 추가합니다. 사전의 식별
메타데이터는 다른 표기를 정준 표기의 검토된 별명(alias)으로 지정할 수
있습니다. 이때 정준 표기의 리터럴 규칙이 그 별명에도 적용됩니다.

## 렌더링과 지시의 결합

| 필드                | 효과                    |
| ----------------- | --------------------- |
| `require_hanja`   | 한글 전용 모드에서도 한자를 보이게 함 |
| `require_hangul`  | 원문 모드에서도 한글 독음을 병기함   |
| `skip_annotation` | 활성 모드의 주 텍스트만 사용함     |

`ORIGINAL`에서 요구한 한글 독음은 병기로 나타납니다.

```python
from gukhanmun import Converter, DictionaryEntry, Directives, MapDictionarySource, RenderMode

converter = Converter(
    dictionaries=[MapDictionarySource([DictionaryEntry("漢字", "한자")])],
    rendering=RenderMode.ORIGINAL,
    directives=Directives(require_hangul=["漢字"]),
)
assert converter.convert("漢字") == "漢字(한자)"
```

`skip_annotation`은 입력을 그대로 보존하는 대신 괄호와 루비(ruby)를
억제합니다. 한글을 주로 하는 모드는 독음을, 한자를 주로 하는 모드는 한자를
남깁니다. HTML 하위 트리(subtree)를 변환하지 않고 두려면
[HTML 보존 규칙](https://canary.gukhanmun.org/ko-KR/guide/python/html.md#%EC%82%AC%EC%9A%A9%EC%9E%90-%EC%A0%95%EC%9D%98-%EB%B3%B4%EC%A1%B4)을 사용합니다.

하나의 표기를 `require_hanja`와 `require_hangul`에 모두 넣을 수 있습니다.
`skip_annotation`이 있으면 다른 요구가 있어도 주해 렌더링을 억제합니다.
입력 시퀀스는 생성 시 변경할 수 없는 튜플(tuple)로 복사됩니다.
