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

__init__ — Initialize empty state for a streamed Markdown block.
__enter__ — Enter the block context and emit an opening blank line.
__exit__ — Flush remaining content and reset the handler.
push — Append a markdown chunk and flush any completed blocks.

BaseMarkdownHandler.__init__

__init__() → None

Initialize empty state for a streamed Markdown block.

BaseMarkdownHandler.__enter__

__enter__() → Self

Enter the block context and emit an opening blank line.

Returns

type: Self

This active markdown handler.

BaseMarkdownHandler.__exit__

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

Flush remaining content and reset the handler.

Parameters

exc_type
type: type[BaseException] | None

Type of exception leaving the context, if any.

exc_val
type: BaseException | None

Exception leaving the context, if any.

exc_tb
type: TracebackType | None

Traceback associated with the exception, if any.

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.