Skip to main content

Module markdown

Module markdown 

Source
Expand description

Markdown rendering using comrak’s tree-based AST.

Two-phase approach:

  1. Parse with comrak → mutable tree AST
  2. AST manipulation: float headings/code blocks/blockquotes out of lists (prevents progressive nesting from LLM output artifacts)
  3. Render tree → styled ANSI lines
  4. Wrap + pad → final output

Structs§

DefaultTextStyle
Default text styling for markdown content. Applied to all text unless overridden by markdown formatting.
Markdown
Markdown rendering component.
MarkdownTheme
Theme functions for markdown elements. Each function takes text and returns styled text with ANSI codes.

Constants§

CODE_BLOCK_INDENT
Indent prefix applied to each code line inside a fenced code block. Defaults to two spaces for visual inset from the backtick fence.

Functions§

create_highlight_fn
Create a syntax highlighting function.
highlight_code
path_to_language
Map a file path to a language identifier for syntax highlighting.

Type Aliases§

HighlightFn
Type alias for code highlighting function.
StyleFn
Type alias for markdown theme styling functions.