# Add-OfficeMarkdownCode

Adds a Markdown code block. Review available syntax, parameters, pipeline guidance, and reference details in PSWriteOffice API Reference.

Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice/0.2.0)

Stars **725**

Forks **84**

Open issues **3**

Total downloads **5,231,343**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-23

Cmdlet 

Aliases: MarkdownCode

**Module**

`PSWriteOffice`

**Aliases**

`MarkdownCode`

**Inputs**

`OfficeIMO.Markdown.MarkdownDoc`

**Outputs**

`OfficeIMO.Markdown.MarkdownDoc`

**Source**

[AddOfficeMarkdownCodeCommand.cs:24](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Markdown/AddOfficeMarkdownCodeCommand.cs#L24) 

Adds a Markdown code block.

## Syntax

```
Add-OfficeMarkdownCode
[-Content] <String>
[[-Language] <String>]
[-PassThru]
[<CommonParameters>]
```

[#](#method-add-officemarkdowncode-string-string-switchparameter)

Parameter set: `Context`

```
Add-OfficeMarkdownCode
[-Content] <String>
-Document <MarkdownDoc>
[[-Language] <String>]
[-PassThru]
[<CommonParameters>]
```

[#](#method-add-officemarkdowncode-string-markdowndoc-string-switchparameter)

Parameter set: `Document`

## Examples

### Add a PowerShell command block to documentation.

```powershell
$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' -Content $script
}
```

Appends a fenced code block with a language identifier.

## Parameters

**-Content String requiredposition: 1**

Code content.

**-Language String optionalposition: 0**

Code language identifier.

**-PassThru SwitchParameter optional**

Emit the Markdown document after appending the code block.

**-Document MarkdownDoc 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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:A5AA253645BEF15C6D4116F170DF872005D259B88FF29AB35E71C2EC45E8950C -->
