> 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.

# Interface: Gukhanmun

A configured hanja-to-hangul converter.  Created by calling
[GukhanmunFactory.load](https://canary.gukhanmun.org/api/js/interfaces/_gukhanmun_napi.GukhanmunFactory.md#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`](https://canary.gukhanmun.org/api/js/interfaces/_gukhanmun_napi.GukhanmunOptions.md), `"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`](https://canary.gukhanmun.org/api/js/types/_gukhanmun_napi.MediaType.md)

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

##### Returns

`string`

The converted text.

##### Throws

[GukhanmunError](https://canary.gukhanmun.org/api/js/classes/_gukhanmun_napi.GukhanmunError.md) 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`](https://canary.gukhanmun.org/api/js/types/_gukhanmun_napi.Format.md)

##### 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`](https://canary.gukhanmun.org/api/js/types/_gukhanmun_napi.MediaType.md)

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

##### Returns

`TransformStream`\<`string`, `string`>

A platform `TransformStream<string, string>`.

##### Throws

[GukhanmunError](https://canary.gukhanmun.org/api/js/classes/_gukhanmun_napi.GukhanmunError.md) 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`](https://canary.gukhanmun.org/api/js/types/_gukhanmun_napi.Format.md)

##### Returns

`TransformStream`\<`string`, `string`>
