Skip to main content
A streaming markdown renderer that buffers potential table headers until confirmed by a separator line, preventing tables from flashing as raw pipe-delimited text during LLM streaming. Outputs markdown (not platform text). Format conversion still happens in the adapter’s editMessage → renderPostable → fromAst pipeline.

Constructor

Parameters

StreamingMarkdownRendererOptions

Returns

StreamingMarkdownRenderer

Methods

finish()

Signal stream end. Flushes held-back lines. Returns final render.

Returns

string

getCommittableText()

Get text safe for append-only streaming (e.g. Slack native streaming).
  • Holds back unconfirmed table headers until separator arrives.
  • Optionally wraps confirmed tables in code fences so pipes render as literal text on append-only surfaces that lack native table support. The code fence is left OPEN while the table is still streaming, keeping output monotonic for deltas.
  • Holds back unclosed inline markers (**, *, ~~, `, [).
  • The final editMessage replaces everything with properly formatted text.

Returns

string

getText()

Raw accumulated text (no remend, no buffering). For the final edit.

Returns

string

push()

Append a chunk from the LLM stream.

Parameters

string
required

render()

Get renderable markdown for an intermediate edit.
  • Holds back trailing lines that look like a table header (|…|) until a separator line (|---|---|) confirms or the next line denies.
  • Applies remend() to close incomplete inline markers.
  • Idempotent: returns cached result if no push() since last call.

Returns

string