Glimmer::Renderer::TermRenderer
TermRenderer transforms Markdown AST into styled terminal output.
This renderer extends Markd::Renderer to produce ANSI-styled output
that matches Glow/Glamour's rendering behavior.
Constants
MARGIN = " "
Constructors
Instance methods
Alert rendering (GitHub-style alerts: > [!NOTE], > [!WARNING], etc.)
Block quote rendering — with styled prefix and content.
Code span rendering — styled with fg+bg color inline.
Code block rendering — with syntax highlighting and code block style.
Emphasis (italic) — pushes italic style onto the stack.
expand_emojis?
SourceHeading rendering — applies heading style (color, bold, bg) to content.
HTML block rendering — preserve literal HTML for terminal output.
HTML inline rendering — preserve literal HTML inline.
List item rendering — with styled bullet/number prefix.
Link rendering — shows styled text + clickable URL (OSC 8).
When link text ends with the URL (e.g., "see LICENSE" linking to LICENSE),
the URL is not appended again to avoid duplication.
Paragraph rendering — wraps text and applies document styling.
profile
Sourceprofile=(profile : Style::ColorProfile)
SourceRenders a markdown string directly.
This is a convenience method that parses the markdown string and renders it.
renderer = Glimmer::Renderer::TermRenderer.new(theme: Glimmer::Style::Theme.dark)
puts renderer.render("# Hello\n\nThis is **bold**")
render(document : Markd::Node)
Walks the Markd AST and dispatches to element handlers.
We override Markd::Renderer#render entirely to:
- Skip Document nodes (which otherwise emit spurious margin via text())
- Avoid Markd's sub("\n", "") which strips the first newline
ameba:disable Metrics/CyclomaticComplexity
Strong (bold) — pushes bold style onto the stack.
Table rendering — collects rows and cells, then renders with borders.
Table cell rendering — collects cell content.
Table row rendering — collects cells into a row.
Text rendering — applies inline styles from the stack.
Thematic break (horizontal rule) — styled dashes.
theme
Sourcetheme=(theme : Style::Theme)
Sourcewidth
Sourcewrapper
Sourcewrapper=(wrapper : WordWrapper)
Source