#指示
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[] | undefinedOrdered 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 | undefinedPer-hanja rendering directives that override dictionary marks.
@seeDirectives directives : {
Directives.requireHanja?: readonly string[] | undefinedHanja 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[] | undefinedHanja forms that must always be shown with a hangul gloss alongside the
original hanja (relevant for rendering: "original").
requireHangul : ["東"],
Directives.skipAnnotation?: readonly string[] | undefinedHanja 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은 모드와 無關하게 一切의 倂記를 抑制합니다.