class

TUI::MarkdownView

Inherits TUI::Scrollable < Reference < Object

Renders a Markdown source string: numbered headings with per-level emphasis (since a terminal can't grow font size), real word-wrapped paragraphs/list items/blockquotes preserving inline styling, nested list indentation with continuation lines aligned under the text (not the marker), and GFM tables with alignment-aware column widths drawn with box-drawing borders. Parsing/wrapping/layout are hand-rolled in TUI::Markdown (this library has zero runtime dependencies) — see TUI::Markdown::Parser/Wrap/Layout for the algorithms; this class is just the Scrollable host: styling properties, caching, and the standard scroll-key handling every other Scrollable already has.

Constructors

new(source : String = "")
Source

Instance methods

bold_italic_style
Source
bold_italic_style=(bold_italic_style : Style)
Source
bold_style
Source
bold_style=(bold_style : Style)
Source
code_style
Source
code_style=(code_style : Style)
Source
content_size

Reports the physical row count for the width this content was LAST actually rendered at (#render_content updates that width every call) — Window#render calls #content_size before it has built the buffer that would tell content this frame's width (confirmed by reading Window#render: total = @content.content_size runs before inner = Buffer.new(inner_width, ...)), so there is structurally no way to answer for the CURRENT frame's width here. This is stale by exactly one frame during an active resize (used only for Scroller#clamp's max-offset math) and self-heals the same frame #render_content next runs with the real width — the same resize-tolerance philosophy Scroller#clamp itself already relies on, rather than widening Scrollable's abstract contract for this one widget's benefit.

Source
handle_click(local_row : Int32, local_col : Int32, scroll : ScrollControl) : Bool

A positional (mouse) event, pre-translated by Window into content-local row/col (0,0 = content's own first cell).

Source
handle_key(ev : KeyEvent, scroll : ScrollControl) : Bool

Everything but positional mouse hit-testing.

Source
heading_indent_step
Source
heading_indent_step=(heading_indent_step : Int32)
Source
heading_styles

Heading styles by level (index 0 = h1), decreasing emphasis since Style has no font-size — numbering (see #number_headings) is the primary way level is conveyed, this is a secondary visual cue.

Source
heading_styles=(heading_styles : Array(Style))

Heading styles by level (index 0 = h1), decreasing emphasis since Style has no font-size — numbering (see #number_headings) is the primary way level is conveyed, this is a secondary visual cue.

Source
hrule_style
Source
hrule_style=(hrule_style : Style)
Source
italic_style
Source
italic_style=(italic_style : Style)
Source
list_bullet_glyphs
Source
list_bullet_glyphs=(list_bullet_glyphs : Array(String))
Source
list_indent_step
Source
list_indent_step=(list_indent_step : Int32)
Source
list_marker_style
Source
list_marker_style=(list_marker_style : Style)
Source
load(source : String) : Nil

Replaces the rendered content and invalidates the cached layout (see #content_size for why layout is cached at all) so the next #content_size/#render_content call re-lays-out unconditionally, even if the new document happens to need the same width as the old cached layout.

Source
number_headings=(number_headings : Bool)

Nested-outline numbering ("1.2.3 Title") in front of every heading. Disable to keep indentation/styling but drop the prefix.

Source
number_headings?

Nested-outline numbering ("1.2.3 Title") in front of every heading. Disable to keep indentation/styling but drop the prefix.

Source
quote_indent_step
Source
quote_indent_step=(quote_indent_step : Int32)
Source
quote_style
Source
quote_style=(quote_style : Style)
Source
render_content(buffer : Buffer, scroll : ScrollControl) : Nil

Render into buffer, a region already sized to the content area (border/scrollbar column already excluded by Window). Row 0 is content's own first row.

Source
status_hint
Source
table_border_style
Source
table_border_style=(table_border_style : Style)
Source
table_header_style
Source
table_header_style=(table_header_style : Style)
Source
title

Set by a host app (e.g. to a document's filename); shown as the hosting Window's border title, same convention as DetailView#title.

Source
title=(title : String)

Set by a host app (e.g. to a document's filename); shown as the hosting Window's border title, same convention as DetailView#title.

Source