yera.runtime.handlers.markdown.htmx

Streaming markdown handler for the HTMX target.

Symbols

class HTMXMarkdownHandler — Render a streaming Markdown block through incremental morph swaps.

HTMXMarkdownHandler

Inherits: BaseHTMXHandler

Render a streaming Markdown block through incremental morph swaps.

Settled Markdown prefixes are committed as immutable segments while the live tail is repeatedly rendered and replaced. A trailing table is rendered through the shared Markdown renderer as soon as its header and delimiter are complete, while an unfinished final row is withheld until more input arrives. This keeps streaming output stable without giving tables, mathematics, or other inline Markdown a separate rendering path.

Methods

__exit__ — Flush the tail unthrottled and unconditionally.
push — Append a chunk; publish at most one swap every ``_MIN_FRAME_S``.

HTMXMarkdownHandler.__exit__

__exit__(
    exc_type: type[BaseException] | None,
    exc_val: BaseException | None,
    exc_tb: TracebackType | None,
)

Flush the tail unthrottled and unconditionally.

The last chunk's swap may have been coalesced away, and render_streaming_markdown holds back an in-progress table row that only a full render releases.

HTMXMarkdownHandler.push

push(
    event: OutputEvent,
) → None

Append a chunk; publish at most one swap every _MIN_FRAME_S.

Parameters

event
type: OutputEvent

An output event carrying MarkdownData.

Raises

TypeError

If the event data is not MarkdownData.