#Markdown 變換
convert()에 形式으로 "text/markdown"을 넘깁니다:
import { function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>Creates a Gukhanmun converter with the given options.
Initialises the WASM module on the first call (subsequent calls reuse the
cached module). Compiled dictionaries supplied via
GukhanmunOptions.dictionaries
are fetched, while
MapDictionarySource
entry lists are serialised and built in memory
as Rust MapDictionary 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" and role: "reference". stdictFst } from "@gukhanmun/stdict-fst";
const const g: Gukhanmun g = await function load(options?: GukhanmunLoadOptions): Promise<Gukhanmun>Creates a Gukhanmun converter with the given options.
Initialises the WASM module on the first call (subsequent calls reuse the
cached module). Compiled dictionaries supplied via
GukhanmunOptions.dictionaries
are fetched, while
MapDictionarySource
entry lists are serialised and built in memory
as Rust MapDictionary 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 ({ dictionaries?: readonly (DictionarySource | LoadedDictionary)[] | undefined 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" and role: "reference". stdictFst ()] });
const const output: string output = const g: Gukhanmun g .Gukhanmun.convert(source: string, format?: MediaType): string (+2 overloads)Converts source to hangul in one shot. Buffers the entire input
before returning.
@paramsource - The text to convert.@paramformat - Input/output media type. Defaults to "text/plain".@returnsThe converted text.@throws{@linkGukhanmunError } on conversion failure. convert ("# 漢字\n\n漢字를 한글로 변환합니다.", "text/markdown");
// → "# 한자\n\n한자를 한글로 변환합니다."#GitHub Flavored Markdown
GFM 擴張(表, 作業 目錄, 取消線)을 켜려면 "text/markdown; variant=GFM"을
넘깁니다:
const const output: string output = const g: Gukhanmun g .Gukhanmun.convert(source: string, format?: MediaType): string (+2 overloads)Converts source to hangul in one shot. Buffers the entire input
before returning.
@paramsource - The text to convert.@paramformat - Input/output media type. Defaults to "text/plain".@returnsThe converted text.@throws{@linkGukhanmunError } on conversion failure. convert (
"| 漢字 | 讀音 |\n|------|------|\n| 東 | 동 |",
"text/markdown; variant=GFM",
);#變換되는 對象
Gukhanmun은 段落 텍스트·헤딩·리스트 項目·引用 블록·表 셀 안의 漢字를 變換합니다.
다음은 恒常 손대지 않습니다:
- 펜스 코드 블록과 들여쓰기 코드 블록
- 인라인 코드 스팬(
`…`) - 날(raw) HTML 블록과 인라인 HTML
- 링크와 이미지 URL