Skip to content

Set-MarkdownSection

SYNOPSIS

Generates a formatted Markdown section with a specified header level, title, and content.

SYNTAX

Set-MarkdownSection [-Level] <Int32> [-Title] <String> [-Content] <ScriptBlock>
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

This function creates a Markdown section with a specified header level, title, and formatted content. The header level determines the number of # symbols used for the Markdown heading. The content is provided as a script block and executed within the function. The function returns the formatted Markdown as a string.

EXAMPLES

EXAMPLE 1

Set-MarkdownSection -Level 2 -Title "Example Section" -Content {
    "This is an example of Markdown content."
}

Output:

## Example Section

This is an example of Markdown content.

Generates a Markdown section with an H2 heading and the given content.

EXAMPLE 2

Section 2 "Example Section" {
    "This is an example of Markdown content."
}

Output:

## Example Section

This is an example of Markdown content.

Generates a Markdown section with an H2 heading and the given content.

PARAMETERS

-Level

Specifies the Markdown header level (1-6).

Type: Int32
Parameter Sets: (All)
Aliases:

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

-Title

The title of the Markdown section.

Type: String
Parameter Sets: (All)
Aliases:

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

-Content

The content to be included in the Markdown section.

Type: ScriptBlock
Parameter Sets: (All)
Aliases:

Required: True
Position: 3
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 formatted Markdown section as a string.

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