Skip to content

Set-MarkdownTable

SYNOPSIS

Converts objects from a script block into a Markdown table.

SYNTAX

Set-MarkdownTable [-InputScriptBlock] <ScriptBlock> [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

The Set-MarkdownTable function executes a provided script block and formats the resulting objects as a Markdown table. Each property of the objects becomes a column, and each object becomes a row in the table. If no objects are returned, a warning is displayed, and no output is produced.

EXAMPLES

EXAMPLE 1

Table {
    Get-Process | Select-Object -First 3 Name, ID
}

Output:

| Name | ID |
| ---- | -- |
| notepad | 1234 |
| explorer | 5678 |
| chrome | 91011 |

Generates a Markdown table from the first three processes, displaying their Name and ID properties.

PARAMETERS

-InputScriptBlock

Script block containing commands whose output will be converted into a Markdown table.

Type: ScriptBlock
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

string

NOTES

The Markdown-formatted table as a string output.

This function returns a Markdown-formatted table string, which can be used in documentation or exported.

https://psmodule.io/Markdown/Functions/Set-MarkdownTable/