# Parsing API

Signatures and descriptions generated from the public TypeScript exports.

## Public contracts

### MarkdownStream

`@quirekit/incremark-core` · MIT

A headless source session; transport status never freezes syntax or reference dependencies.

```ts
export class MarkdownStream {
    constructor(options?: MarkdownOptions);
    get content(): string;
    append(chunk: string): void;
    reset(content?: string): void;
    get state(): EditorState;
    get pending(): boolean;
    update(content: string): void;
    advance(budget?: number): boolean;
}
```

### parseMarkdown

`@quirekit/incremark-core` · MIT

Completes the canonical grammar for deterministic static rendering, without mounting a view.
@param content - Exact source; the returned state uses CM logical newlines.
@param options - Pure syntax and semantic extensions.
@returns Accepted source snapshot, reusable by the Vue renderer or native consumers.

```ts
function parseMarkdown(content: string, options?: MarkdownOptions): EditorState
```

### MarkdownOptions

`@quirekit/incremark-core` · MIT

Source configuration, fixed for the lifetime of one reading session.

```ts
export interface MarkdownOptions {
    readonly preset?: "extended" | false;
    readonly extensions?: readonly AnyExtension[];
    readonly syntax?: readonly MarkdownExtension[];
}
```

**preset** — Extended Markdown defaults (notes, math, containers and inline extras); false installs only core GFM plus explicit extensions.

**extensions** — Source-bearing features, including validated custom Node/Mark definitions.

**syntax** — Native Lezer syntax additions; use a source codec when fields also need validation.

### MarkdownLocale

`@quirekit/incremark-core` · MIT

Reading control language, independent of document text.

```ts
export type MarkdownLocale = "zh-CN" | "en";
```

### MarkdownStatus

`@quirekit/incremark-core` · MIT

Transport metadata; no terminal status freezes parsing or discards received text.

```ts
export type MarkdownStatus = "receiving" | "complete" | "stopped" | "error";
```

### MarkdownReadingError

`@quirekit/incremark-core` · MIT

A source-preserving failure, isolated to its captured node or parsing session.

```ts
export interface MarkdownReadingError {
    readonly owner: string;
    readonly phase: "parse" | "read" | "load" | "render" | "dispose";
    readonly from: number;
    readonly to: number;
    readonly cause: unknown;
}
```

**owner** — Installed owner or the source session.

**phase** — Failed operation.

**from** — Inclusive UTF-16 start in the captured source.

**to** — Exclusive UTF-16 end in the captured source.

**cause** — Original error for host diagnostics.
