Expand description
Markdown rendering using comrak’s tree-based AST.
Two-phase approach:
- Parse with comrak → mutable tree AST
- AST manipulation: float headings/code blocks/blockquotes out of lists (prevents progressive nesting from LLM output artifacts)
- Render tree → styled ANSI lines
- Wrap + pad → final output
Structs§
- Default
Text Style - Default text styling for markdown content. Applied to all text unless overridden by markdown formatting.
- Markdown
- Markdown rendering component.
- Markdown
Theme - 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§
- Highlight
Fn - Type alias for code highlighting function.
- StyleFn
- Type alias for markdown theme styling functions.