Skip to content
ConsoleMonster
Class

MarkdownView

ConsoleMonster.Widgets

Namespace
ConsoleMonster.Widgets
Assembly
ConsoleMonster
Modifiers
sealed

A semantic Markdown render target composed from the existing console widgets. It accepts already parsed blocks; it does not parse Markdown or claim CommonMark conformance. Parser adapters can populate this view without introducing a parser dependency into the console engine.

Inheritance

  • object
  • MarkdownView

Usage

Explore 11 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 2

Constructors

public MarkdownView() #

Methods

public MarkdownView AddBlock(IWidget block) #

Adds a native widget as a parsed document block.

Parameters

block ConsoleMonster.Layout.IWidget required
The block. The caller must not subsequently introduce a layout cycle.

Returns

MarkdownView This view.
public MarkdownView AddCode(string text, string? language = null) #

Adds literal code with a language label and the existing registered highlighter, when available.

Parameters

text string required
The source code, without fence delimiters.
language string? = null optional
The fence language. Unknown languages display plain code with their original label.

Returns

MarkdownView This view.
public MarkdownView AddHeading(RichText text, int level = 1) #

Adds a heading with a double rule for level one, a single rule for level two, and visible level markers below that.

Parameters

text ConsoleMonster.Text.RichText required
Parsed heading content.
level int = 1 optional
The heading level, from one through six.

Returns

MarkdownView This view.
public MarkdownView AddList(IEnumerable<MarkdownView> items, int? start = null, bool tight = true) #

Adds a list with hanging indents and nested block support.

Parameters

items System.Collections.Generic.IEnumerable<ConsoleMonster.Widgets.MarkdownView> required
One parsed document per list item.
start int? = null optional
The first ordered-list number, or null for bullets.
tight bool = true optional
Whether to omit blank rows between items.

Returns

MarkdownView This view.
public MarkdownView AddParagraph(RichText text) #

Adds a paragraph. Literal segments remain literal; links get a visible URL on terminals without OSC 8.

Parameters

text ConsoleMonster.Text.RichText required
Parsed inline content.

Returns

MarkdownView This view.
public MarkdownView AddQuote(MarkdownView content) #

Adds a block quote, retaining nested blocks and wrapping beside a muted vertical bar.

Parameters

content ConsoleMonster.Widgets.MarkdownView required
The quote's parsed blocks.

Returns

MarkdownView This view.
public MarkdownView AddRule() #

Adds a thematic break.

Returns

MarkdownView This view.
public MarkdownView AddTable(IReadOnlyList<RichText> headers, IEnumerable<IReadOnlyList<RichText>> rows, IReadOnlyList<HorizontalAlignment?>? alignments = null) #

Adds a table using the console table's width negotiation, wrapping and compact record layouts.

Parameters

headers System.Collections.Generic.IReadOnlyList<ConsoleMonster.Text.RichText> required
Parsed header cells.
rows System.Collections.Generic.IEnumerable<System.Collections.Generic.IReadOnlyList<ConsoleMonster.Text.RichText>> required
Parsed body rows; each must have the same number of cells as the header.
alignments System.Collections.Generic.IReadOnlyList<ConsoleMonster.Layout.HorizontalAlignment?>? = null optional
Optional per-column alignment from the Markdown delimiter row.

Returns

MarkdownView This view.
public Size Measure(Constraints constraints, RenderContext context) #

Returns the size the widget wants within the constraints.

Parameters

constraints ConsoleMonster.Layout.Constraints required
The space offered.
context ConsoleMonster.Canvas.RenderContext required
Profile, theme and glyphs.

Returns

Size The desired size, never larger than the constraints.
public void Render(Region region, RenderContext context) #

Renders into a region. The region may be smaller or larger than the measured size.

Parameters

region ConsoleMonster.Canvas.Region required
The target region.
context ConsoleMonster.Canvas.RenderContext required
Profile, theme and glyphs.

Properties

public IReadOnlyList<IWidget> Children { get; } #

The rendered blocks, in document order.