Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Add-OfficeMarkdownCode

Aliases: MarkdownCode
Module
PSWriteOffice
Aliases
MarkdownCode
Inputs
OfficeIMO.Markdown.MarkdownDocument
Outputs
OfficeIMO.Markdown.MarkdownDocument

Adds a Markdown code block.

Syntax

Add-OfficeMarkdownCode
[[-Language] <String>]
[-PassThru]
[-Text] <String>
[<CommonParameters>]
#
Parameter set: Context
Add-OfficeMarkdownCode
-Document <MarkdownDocument>
[[-Language] <String>]
[-PassThru]
[-Text] <String>
[<CommonParameters>]
#
Parameter set: Document

Examples

Add a PowerShell command block to documentation.

$script = @(
    'Import-Module PSWriteOffice'
    'Get-OfficeExcelSummary -Path .\report.xlsx'
) -join [Environment]::NewLine
New-OfficeMarkdown -Path .\Cookbook.md {
    Add-OfficeMarkdownHeading -Level 2 -Text 'Workbook summary'
    Add-OfficeMarkdownCode -Language 'powershell' -Text $script
}

Appends a fenced code block with a language identifier.

Parameters

-Language String optionalposition: 0
Code language identifier.
-PassThru SwitchParameter optional
Emit the Markdown document after appending the code block.
-Text String requiredposition: 1
Code content.
-Document MarkdownDocument requiredpipeline: True (ByValue)sets: Document
Markdown document to update outside the DSL context.

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.