For AI agents: the complete documentation index is available at https://canary.gukhanmun.org/llms.txt, the full documentation bundle is available at https://canary.gukhanmun.org/llms-full.txt, and this page is available as Markdown at https://canary.gukhanmun.org/api/js/interfaces/_gukhanmun_types.Gukhanmun.md.

Interface: Gukhanmun

A configured hanja-to-hangul converter. Created by calling GukhanmunFactory.load (or the top-level load function).

The instance is immutable after creation; call load again to obtain a converter with different options.

Properties

options

readonly options: Readonly<Required<Omit<GukhanmunOptions, "dictionaries" | "directives" | "html" | "originalGloss" | "punctuation">> & object>

Read-only view of the resolved options (after preset defaults are applied). Excludes dictionaries, directives, html, and originalGloss, which are not meaningfully representable as plain values.

Methods

convert()

Call Signature

convert(source, format?): string

Converts source to hangul in one shot. Buffers the entire input before returning.

Parameters
source

string

The text to convert.

format?

MediaType

Input/output media type. Defaults to "text/plain".

Returns

string

The converted text.

Throws

GukhanmunError on conversion failure.

Call Signature

convert(source, format): string

Parameters
source

string

format

"text" | "html" | "markdown" | { format: "markdown"; gfm?: boolean; } | undefined

Returns

string

Deprecated

Legacy selectors will be removed in Gukhanmun 1.0. Instead pass "text/plain", "text/html", or "text/markdown" for "text", "html", or "markdown", respectively. For Markdown objects, use "text/markdown; variant=GFM" if gfm is true or "text/markdown" otherwise.

Call Signature

convert(source, format?): string

Converts source when format can be either a media type or a legacy selector.

Parameters
source

string

format?

Format

Returns

string


stream()

Call Signature

stream(format?): TransformStream<string, string>

Returns a TransformStream<string, string> that converts chunks incrementally. Chunks are JavaScript strings; byte-level encoding is the caller's responsibility (TextDecoderStream / TextEncoderStream).

The stream guarantees that the concatenated output equals the result of calling convert on the concatenated input, regardless of chunk boundaries. Document-wide middlewares (e.g., homophone marking with homophoneWindow: "per-document") buffer until the writable side is closed.

Parameters
format?

MediaType

Input/output media type. Defaults to "text/plain".

Returns

TransformStream<string, string>

A platform TransformStream<string, string>.

Throws

GukhanmunError on initialisation failure (not on chunk errors; those are signalled via the stream's error channel).

Call Signature

stream(format): TransformStream<string, string>

Parameters
format

"text" | "html" | "markdown" | { format: "markdown"; gfm?: boolean; } | undefined

Returns

TransformStream<string, string>

Deprecated

Legacy selectors will be removed in Gukhanmun 1.0. Instead pass "text/plain", "text/html", or "text/markdown" for "text", "html", or "markdown", respectively. For Markdown objects, use "text/markdown; variant=GFM" if gfm is true or "text/markdown" otherwise.

Call Signature

stream(format?): TransformStream<string, string>

Opens a stream when format can be either a media type or a legacy selector.

Parameters
format?

Format

Returns

TransformStream<string, string>