mdz_stream_parser_url.ts

Auto-URL and auto-path handlers (text-first scanning) for the streaming mdz parser. Operates in two phases:

1. Speculative prefix matching: chars stream as visible text while we verify a https:// / http:// prefix. 2. Confirmed mode: chars stream as text and on terminator a wrap opcode retroactively wraps the text node in a Link.

Paths (/..., ./..., ../...) skip phase 1 — their prefix is validated by hold (require enough lookahead).

Declarations
#

9 declarations

view source

complete_pending_url
#

mdz_stream_parser_url.ts view source

(state: MdzStreamParserState): void import {complete_pending_url} from '@fuzdev/fuz_ui/mdz_stream_parser_url.js';

Complete a pending URL: compute reference with trimmed punctuation, emit a wrap opcode to retroactively wrap the text node in a Link.

state

returns

void

process_url_content
#

mdz_stream_parser_url.ts view source

(state: MdzStreamParserState, forced: boolean): void import {process_url_content} from '@fuzdev/fuz_ui/mdz_stream_parser_url.js';

Process URL/path chars in text-first mode. Scans path chars, accumulates as visible text. Terminates on space/newline/non-path-char and emits a wrap opcode.

state

forced

type boolean

returns

void

process_url_prefix
#

mdz_stream_parser_url.ts view source

(state: MdzStreamParserState): void import {process_url_prefix} from '@fuzdev/fuz_ui/mdz_stream_parser_url.js';

Speculative URL prefix matching. Checks each char against viable prefixes, streaming as text. Confirms on full match, cancels on mismatch.

Scheme letters (h, t, p, s) are matched case-insensitively (RFC 3986); the : and // portion remains literal. Original casing is preserved in the emitted reference.

state

returns

void

scan_auto_link_forced
#

start_pending_url
#

mdz_stream_parser_url.ts view source

(state: MdzStreamParserState, link_type: "external" | "internal"): void import {start_pending_url} from '@fuzdev/fuz_ui/mdz_stream_parser_url.js';

Start confirmed text-first mode for paths. Prefix already validated by hold. Flushes prior text, resets active_text_id, sets pending_url with confirmed=true.

state

link_type

type "external" | "internal"

returns

void

start_speculative_url
#

mdz_stream_parser_url.ts view source

(state: MdzStreamParserState): void import {start_speculative_url} from '@fuzdev/fuz_ui/mdz_stream_parser_url.js';

Start speculative text-first mode for URL prefixes. Chars stream as visible text while we verify https:// or http://. Cancels if prefix doesn't match (text stays as plain text).

state

returns

void

try_auto_path_absolute
#

try_auto_path_relative
#

try_auto_url_forced
#

mdz_stream_parser_url.ts view source

(state: MdzStreamParserState): TryResult import {try_auto_url_forced} from '@fuzdev/fuz_ui/mdz_stream_parser_url.js';

Forced-mode URL detection: the full prefix must be in the buffer. Used at EOF when speculative prefix matching isn't needed. Scheme match is case-insensitive (RFC 3986).

state

returns

TryResult

Depends on
#

Imported by
#