Skip to content
ConsoleMonster
Cmdlet

New-ConsoleDocumentViewer

Module
ConsoleMonster
Outputs
ConsoleMonster.Interactive.DocumentViewer

Creates a document viewer for a region of Show-ConsoleApp.

Syntax

New-ConsoleDocumentViewer
[-Disabled]
[-Height <Int32>]
[-Key] <String>
[[-Label] <String>]
-Markdown <String>
[-OnChange <ScriptBlock>]
[-TabIndex <Int32>]
[-ValidationMessage <String>]
[<CommonParameters>]
#
Parameter set: Markdown
New-ConsoleDocumentViewer
[-Disabled]
[-Height <Int32>]
[-Key] <String>
[[-Label] <String>]
[-OnChange <ScriptBlock>]
[-TabIndex <Int32>]
[-ValidationMessage <String>]
-Widget <IWidget>
[<CommonParameters>]
#
Parameter set: Widget
New-ConsoleDocumentViewer
[-Disabled]
[-Height <Int32>]
[-Key] <String>
[[-Label] <String>]
[-OnChange <ScriptBlock>]
-Parts <IDictionary>
[-TabIndex <Int32>]
[-ValidationMessage <String>]
[<CommonParameters>]
#
Parameter set: Parts

Description

Browse a widget or Markdown with a pinned heading path, an outline when there is room, folding headings, and find. Named parts appear as tabs. Alt+Down/Up changes panes inside the viewer, and Tab moves to the next app control. Use [ and ] to select a link, Enter to follow it, and Alt+Left/Right to go back and forward. The state value is the current heading title, or null before a heading.

Examples

Example 1

$runbook = "# Health" + [Environment]::NewLine + "Check the dashboard first."
Show-ConsoleApp -Content {
    New-ConsoleDocumentViewer -Key runbook -Markdown $runbook
    New-ConsoleButton -Key refresh -Label 'Refresh'
}

Put a runbook alongside other app controls.

Parameters

-Disabled SwitchParameter optional
Disables editing and removes the input from keyboard focus traversal.
-Height Int32 optional
Natural visible content rows.
-Key String requiredposition: 0
Unique key in the application's state and final hashtable.
-Label String optionalposition: 1
Visible label; defaults to the name using the core control's labels.
-Markdown String requiredsets: Markdown
Markdown source. Headings become outline entries and foldable sections.
-OnChange ScriptBlock optional
Runs once per committed edit on the owning input thread. Receives param($Value, $State) and injected $Value, $State and $Control. State is a hashtable; add or assign keys to write back. Output is discarded. Retains closure variables.
-TabIndex Int32 optional
Keyboard focus order. Equal values preserve layout declaration order.
-ValidationMessage String optional
Initial validation text displayed below the input.
-Widget IWidget requiredsets: Widget
A widget to browse, such as a view returned by Show-Console -AsWidget.
-Parts IDictionary requiredsets: Parts
A dictionary from tab title to Markdown text or a widget. Use an ordered dictionary to set tab order.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.