yera.runtime.blocks.markdown

Emit Markdown as a one-shot block or an ordered stream of chunks.

A one-shot call emits its content and immediately closes the block. A MarkdownStream retains one block identity across appended chunks, establishes a parent scope for nested output, and closes when its context exits.

Symbols

class MarkdownStream — Emit ordered Markdown chunks under one block identity.

MarkdownStream

Inherits: _StreamHandle

Emit ordered Markdown chunks under one block identity.

Each append is pushed immediately for incremental rendering. Entering the context establishes this block as the parent of nested output; leaving it emits the terminal event.

Methods

__init__ — Initialize a markdown stream handle.
__enter__ — Open the markdown block scope.
__exit__ — Close the markdown block scope.
append — Append a new chunk to this markdown block.
new_line — Append a paragraph break and content to this markdown block.

MarkdownStream.__init__

__init__(
    block_id: str,
)

Initialize a markdown stream handle.

Parameters

block_id
type: str

Identity shared by all emitted chunks.

MarkdownStream.__enter__

__enter__()

Open the markdown block scope.

Returns

This stream handle.

MarkdownStream.__exit__

__exit__(
    exc_type: type[BaseException],
    exc_value: BaseException | None,
    traceback: TracebackType,
)

Close the markdown block scope.

Parameters

exc_type
type: type[BaseException]

Type of exception leaving the context, if any.

exc_value
type: BaseException | None

Exception leaving the context, if any.

traceback
type: TracebackType

Traceback associated with the exception, if any.

Returns

False so exceptions propagate from the managed block.

MarkdownStream.append

append(
    content: str,
) → None

Append a new chunk to this markdown block.

Parameters

content
type: str

Markdown content to emit.

MarkdownStream.new_line

new_line(
    content: str,
) → None

Append a paragraph break and content to this markdown block.

Parameters

content
type: str

Markdown content to emit after the break.