Table of Contents

Class MarkdownTable

Namespace
Terminal.Gui.Views
Assembly
Terminal.Gui.dll

A read-only view that renders a single Markdown table with box-drawing borders via LineCanvas and styled header/body text with inline Markdown formatting.

public sealed class MarkdownTable : View, IDisposable, ISupportInitializeNotification, ISupportInitialize, IDesignable
Inheritance
MarkdownTable
Implements
Inherited Members
Extension Methods

Remarks

When used inside a Markdown, instances are created automatically during layout and positioned as SubViews at the correct content coordinate so that they scroll naturally with the parent's viewport.

Borders are rendered using Single.

Header cells are bold; body cells support inline Markdown formatting (bold, italic, code, links) via Terminal.Gui.Views.MarkdownInlineParser. Column alignment (left, center, right) parsed from the Markdown separator row is respected. Cells that exceed their column width are word-wrapped, and row heights expand to accommodate wrapped content.

This view can also be used standalone. Use the parameterless constructor and set TableData to provide table content.

Constructors

MarkdownTable()

Initializes a new empty MarkdownTable.

Properties

SyntaxHighlighter

Gets or sets an optional syntax highlighter used to resolve theme-based attributes for inline styling roles (emphasis, code spans, links, etc.). When set, the table queries the highlighter for scope-derived colors before falling back to TextStyle-based defaults.

TableData

Gets or sets the TableData that defines the table content. Setting this recomputes column widths, row heights, and redraws the table.

Text

Gets or sets the table content as a pipe-delimited Markdown table string. The setter parses the text via TryParse(IReadOnlyList<string>) and updates TableData. Invalid or empty text clears the table.

UseThemeBackground

Gets or sets whether the table uses the syntax highlighting theme's background color for cell and border fills. Defaults to false.

Methods

CalculateTableHeight(TableData)

Gets the total rendered height of this table in lines (simple estimate).

OnDrawingContent(DrawContext?)

Called when the View's content is to be drawn. The default implementation does nothing.

OnSubViewLayout(LayoutEventArgs)

Called from Terminal.Gui.ViewBase.View.LayoutSubViews before any subviews have been laid out.