mdz_stream_parser_inline.ts

Inline-formatting handlers (bold, italic, strikethrough, inline code) for the streaming mdz parser.

Declarations
#

11 declarations

view source

check_close_word_boundary
#

close_bold
#

mdz_stream_parser_inline.ts view source

(state: MdzStreamParserState, stack_idx: number): boolean import {close_bold} from '@fuzdev/fuz_ui/mdz_stream_parser_inline.js';

Close a Bold container at the given stack index. The caller in process_inline already located the open via find_open, so we trust the index rather than re-walking the stack.

state

stack_idx

type number

returns

boolean

close_single_delimiter
#

code_search_limit
#

mdz_stream_parser_inline.ts view source

(state: MdzStreamParserState, from: number): number import {code_search_limit} from '@fuzdev/fuz_ui/mdz_stream_parser_inline.js';

Compute search limit for inline code scanning. Finds the closest closing delimiter for any open formatting on the stack. This prevents backtick scanning from crossing bold/italic/etc boundaries.

state

from

type number

returns

number

has_inline_formatting_on_stack
#

mdz_stream_parser_inline.ts view source

(state: MdzStreamParserState): boolean import {has_inline_formatting_on_stack} from '@fuzdev/fuz_ui/mdz_stream_parser_inline.js';

Check if any inline formatting container (Bold, Italic, Strikethrough, Link) is on the stack above the current block boundary. Used to decide whether backtick can go optimistic — when formatting is open, the code span might cross the formatting boundary, so we hold instead.

state

returns

boolean

process_code_content
#

mdz_stream_parser_inline.ts view source

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

Process content inside an optimistic inline Code container. Scans raw text (no inline formatting) until closing backtick or newline. Backtick closes (or reverts if empty). Newline reverts (code can't span lines).

state

returns

void

scan_closer_boundary
#

mdz_stream_parser_inline.ts view source

(state: MdzStreamParserState, delimiter: string): "confirmed" | "rejected" | "pending" import {scan_closer_boundary} from '@fuzdev/fuz_ui/mdz_stream_parser_inline.js';

Scan for the first potential closing delimiter and check its word boundary. Returns a tri-state: - 'confirmed': closer found in buffer with valid word boundary - 'rejected': closer found but with invalid word boundary (greedy first-match fails) - 'pending': no closer in buffer yet, or can't determine boundary

Optimistic constructs (strikethrough) treat 'pending' as proceed. Non-optimistic constructs (italic) treat 'pending' as text.

Uses native indexOf instead of a manual char loop for faster scanning.

state

delimiter

type string

returns

"confirmed" | "rejected" | "pending"

try_bold
#

try_code
#

try_italic
#

try_strikethrough
#

Depends on
#

Imported by
#