# Add-OfficeMarkdownTableOfContents

Adds a Markdown table of contents placeholder. 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 **722**

Forks **84**

Open issues **2**

Total downloads **5,205,291**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-22

Cmdlet 

Aliases: MarkdownTableOfContents, MarkdownToc

**Module**

`PSWriteOffice`

**Aliases**

`MarkdownTableOfContents` `MarkdownToc`

**Inputs**

`OfficeIMO.Markdown.MarkdownDoc`

**Outputs**

`OfficeIMO.Markdown.MarkdownDoc`

**Source**

[AddOfficeMarkdownTableOfContentsCommand.cs:25](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Markdown/AddOfficeMarkdownTableOfContentsCommand.cs#L25) 

Adds a Markdown table of contents placeholder.

## Syntax

```
Add-OfficeMarkdownTableOfContents
[-ForPreviousHeading]
[-ForSection <String>]
[-MaxLevel <Int32>]
[-MinLevel <Int32>]
[-Ordered]
[-PassThru]
[-PlaceAtTop]
[-Title <String>]
[-TitleLevel <Int32>]
[<CommonParameters>]
```

[#](#method-add-officemarkdowntableofcontents-switchparameter-string-int32-int32-switchparameter-switchparameter-switchparameter-string-int32)

Parameter set: `Context`

```
Add-OfficeMarkdownTableOfContents
-Document <MarkdownDoc>
[-ForPreviousHeading]
[-ForSection <String>]
[-MaxLevel <Int32>]
[-MinLevel <Int32>]
[-Ordered]
[-PassThru]
[-PlaceAtTop]
[-Title <String>]
[-TitleLevel <Int32>]
[<CommonParameters>]
```

[#](#method-add-officemarkdowntableofcontents-markdowndoc-switchparameter-string-int32-int32-switchparameter-switchparameter-switchparameter-string-int32)

Parameter set: `Document`

## Examples

### Add a TOC at the top of a generated report.

```powershell
New-OfficeMarkdown -Path .\Report.md {
    Add-OfficeMarkdownHeading -Level 1 -Text 'Release Report'
    Add-OfficeMarkdownHeading -Level 2 -Text 'Summary'
    Add-OfficeMarkdownParagraph -Text 'Current state and risks.'
    Add-OfficeMarkdownHeading -Level 2 -Text 'Appendix'
    Add-OfficeMarkdownParagraph -Text 'Supporting evidence.'
    Add-OfficeMarkdownTableOfContents -Title 'Contents' -MinLevel 2 -MaxLevel 3 -PlaceAtTop
}
```

Inserts a generated table of contents for headings in the document.

## Parameters

**-ForPreviousHeading SwitchParameter optional**

Scope the TOC to the previous heading.

**-ForSection String optional**

Scope the TOC to the named section heading.

**-MaxLevel Int32 optional**

Maximum heading depth included in the table of contents.

**-MinLevel Int32 optional**

Minimum heading depth included in the table of contents.

**-Ordered SwitchParameter optional**

Generate an ordered table of contents list.

**-PassThru SwitchParameter optional**

Emit the updated Markdown document.

**-PlaceAtTop SwitchParameter optional**

Insert the TOC at the start of the document.

**-Title String optional**

Heading text displayed above the generated table of contents.

**-TitleLevel Int32 optional**

Heading level used for the TOC title.

**-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:CA884EA9ED7C21CA3953B8603B09AFB0D709766BAF7002B4EAD6F0DCF600DECC -->
