Skip to content

Set-MarkdownCodeBlock

SYNOPSIS

Generates a fenced code block for Markdown using the specified language.

SYNTAX

__AllParameterSets

Set-MarkdownCodeBlock [-Language] <string> [-Content] <scriptblock> [-Execute] [<CommonParameters>]

ALIASES

This cmdlet has the following aliases, {{Insert list of aliases}}

DESCRIPTION

This function takes a programming language and a script block, and depending on the provided parameters, either captures the script block's literal text (with indentation normalized) or executes it and captures the string representation of the output. It then formats the result as a fenced code block suitable for Markdown.

EXAMPLES

EXAMPLE 1

Set-MarkdownCodeBlock -Language 'PowerShell' -Content { Get-Process }

Output:

Get-Process

Generates a fenced code block with the specified PowerShell script.

EXAMPLE 2

CodeBlock 'PowerShell' { Get-Process }

Output:

Get-Process

Generates a fenced code block with the specified PowerShell script.

EXAMPLE 3

CodeBlock -Language 'PowerShell' -Content { Get-Process | Select-Object -First 1 } -Execute

Output:

NPM(K)    PM(M)      WS(M)     CPU(s)      Id  SI ProcessName
------    -----      -----     ------      --  -- -----------
    13     4.09      15.91       0.00    9904   0 AggregatorHost

Generates a fenced code block with the output of the specified PowerShell script.

PARAMETERS

-Content

{{ Fill Content Description }}

Type: System.Management.Automation.ScriptBlock
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 1
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Execute

{{ Fill Execute Description }}

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Language

{{ Fill Language Description }}

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

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

INPUTS

OUTPUTS

string

{{ Fill in the Description }}

System.String

{{ Fill in the Description }}

NOTES

Returns the formatted fenced code block as a string.