MarkdownView
ConsoleMonster.Widgets
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.
Returned or exposed by 9
- Method MarkdownConsole.Parse
- Method MarkdownView.AddBlock
- Method MarkdownView.AddCode
- Method MarkdownView.AddHeading
- Method MarkdownView.AddList
- Method MarkdownView.AddParagraph
- Method MarkdownView.AddQuote
- Method MarkdownView.AddRule
- Method MarkdownView.AddTable
Accepted by parameters 2
- Method MarkdownView.AddList
- Method MarkdownView.AddQuote
Constructors
public MarkdownView() #Methods
public MarkdownView AddBlock(IWidget block) #Adds a native widget as a parsed document block.
Parameters
- block ConsoleMonster.Layout.IWidget
- The block. The caller must not subsequently introduce a layout cycle.
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
- The source code, without fence delimiters.
- language string? = null
- The fence language. Unknown languages display plain code with their original label.
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
- Parsed heading content.
- level int = 1
- The heading level, from one through six.
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>
- One parsed document per list item.
- start int? = null
- The first ordered-list number, or null for bullets.
- tight bool = true
- Whether to omit blank rows between items.
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
- Parsed inline content.
public MarkdownView AddQuote(MarkdownView content) #Adds a block quote, retaining nested blocks and wrapping beside a muted vertical bar.
Parameters
- content ConsoleMonster.Widgets.MarkdownView
- The quote's parsed blocks.
public MarkdownView AddRule() #Adds a thematic break.
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>
- Parsed header cells.
- rows System.Collections.Generic.IEnumerable<System.Collections.Generic.IReadOnlyList<ConsoleMonster.Text.RichText>>
- Parsed body rows; each must have the same number of cells as the header.
- alignments System.Collections.Generic.IReadOnlyList<ConsoleMonster.Layout.HorizontalAlignment?>? = null
- Optional per-column alignment from the Markdown delimiter row.
public Size Measure(Constraints constraints, RenderContext context) #Returns the size the widget wants within the constraints.
Parameters
- constraints ConsoleMonster.Layout.Constraints
- The space offered.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
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
- The target region.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
Inherited Methods
Properties
public IReadOnlyList<IWidget> Children { get; } #The rendered blocks, in document order.