yera.runtime.handlers.markdown.base

Abstract base class for streaming markdown event handlers.

Symbols

class BaseMarkdownHandler — Abstract base for streaming markdown block handlers.

BaseMarkdownHandler

Inherits: BaseHandler

Abstract base for streaming markdown block handlers.

Manages buffer state and commit logic for streaming markdown content, delegating environment-specific rendering to subclasses via abstract primitive methods. Handles code blocks and display math detection in addition to plain markdown.

Subclasses must implement _render_markdown, _render_code, _render_latex, _push_buffer_to_live, _clear_live, and _print_blank_line.

Methods

__enter__ — Enter the block context and emit an opening blank line.
__exit__ — Flush remaining buffer, emit a closing blank line, and reset state.
push — Append a markdown chunk and flush any completed blocks.

BaseMarkdownHandler.__enter__

__enter__() → Self

Enter the block context and emit an opening blank line.

BaseMarkdownHandler.__exit__

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

Flush remaining buffer, emit a closing blank line, and reset state.

BaseMarkdownHandler.push

push(
    event: OutputEvent,
) → None

Append a markdown chunk and flush any completed blocks.

Parameters

event
type: OutputEvent

A markdown output event whose data carries the next chunk.