지시

directives 옵션을 사용하면 특정 한자 문자에 대해 병기 표지를 덮어쓸 수 있습니다.

지시 인터페이스

interface Directives {
  
Directives.requireHanja?: string[] | undefined
requireHanja
?: string[]; // 出力에 漢字를 恒常 表示
Directives.requireHangul?: string[] | undefined
requireHangul
?: string[]; // 한글 讀音을 恒常 表示("original" 모드用)
Directives.skipAnnotation?: string[] | undefined
skipAnnotation
?: string[]; // 倂記를 全的으로 抑制
}

각 배열은 표지를 덮어쓰려는 한자 문자열을 담습니다:

import { 
function load(options?: GukhanmunOptions): Promise<Gukhanmun>

Creates a Gukhanmun converter with the given options.

Initialises the WASM module on the first call (subsequent calls reuse the cached module). Dictionaries supplied via GukhanmunOptions.dictionaries are fetched and passed to the Rust engine as FileDictionarySource values.

Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

@paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
load
} from "@gukhanmun/wasm";
import {
function stdictFst(): Promise<FileDictionarySource>

Loads the bundled Standard Korean Language Dictionary as a

FileDictionarySource ready to pass to load({ dictionaries: [...] }).

@returnsA FileDictionarySource with format: "fst".
stdictFst
} from "@gukhanmun/stdict-fst";
const
const g: Gukhanmun
g
= await
function load(options?: GukhanmunOptions): Promise<Gukhanmun>

Creates a Gukhanmun converter with the given options.

Initialises the WASM module on the first call (subsequent calls reuse the cached module). Dictionaries supplied via GukhanmunOptions.dictionaries are fetched and passed to the Rust engine as FileDictionarySource values.

Note: unlike the Rust ko-kr preset, the JavaScript preset never includes a bundled dictionary. Pass dictionaries: [await stdictFst()] to include the Standard Korean Language Dictionary.

@paramoptions - Conversion options. All fields are optional; defaults match the ko-kr preset.@returnsA Gukhanmun instance.@throws{@linkGukhanmunError } on invalid options or dictionary load failure.
load
({
GukhanmunOptions.dictionaries?: readonly FileDictionarySource[] | undefined

Ordered list of dictionary sources. Sources are queried in order; earlier entries take precedence. When omitted (or empty), only the fallback Unihan character map is used (no stdict).

Unlike the "ko-kr" Rust preset, JavaScript presets do not automatically include a bundled dictionary. To use the Standard Korean Language Dictionary, add @gukhanmun/stdict-fst or @gukhanmun/stdict-cdb explicitly.

@seeDictionarySource
dictionaries
: [await
function stdictFst(): Promise<FileDictionarySource>

Loads the bundled Standard Korean Language Dictionary as a

FileDictionarySource ready to pass to load({ dictionaries: [...] }).

@returnsA FileDictionarySource with format: "fst".
stdictFst
()],
GukhanmunOptions.directives?: Directives | undefined

Per-hanja rendering directives that override dictionary marks.

@seeDirectives
directives
: {
Directives.requireHanja?: readonly string[] | undefined

Hanja forms that must always be shown with their original hanja alongside the hangul reading, as if requireHanja were set in the dictionary.

requireHanja
: ["漢", "字"],
Directives.requireHangul?: readonly string[] | undefined

Hanja forms that must always be shown with a hangul gloss alongside the original hanja (relevant for rendering: "original").

requireHangul
: ["東"],
Directives.skipAnnotation?: readonly string[] | undefined

Hanja forms whose annotation should be suppressed entirely; the renderer emits only the primary plain text form (hangul or hanja depending on rendering).

skipAnnotation
: ["中"],
}, });

렌더링 모드와의 결합

지시는 활성 렌더링 모드와 상호작용합니다:

  • requireHanja"hangul-only" 모드에서 가장 잘 드러나며, 한자가 한글 독음 곁에 나타나도록 강제합니다.
  • requireHangul"original" 모드에서 특정 문자의 한글 병기를 강제하는 데 유용합니다.
  • skipAnnotation은 모드와 무관하게 일절의 병기를 억제합니다.