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
readonlyoptions: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?
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?
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?
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?
Returns
TransformStream<string, string>