Project

PSWriteOffice

PowerShell document automation across Word, Excel, PowerPoint, PDF, Reader, Confluence, Visio, and open text formats.

Stars 159
Forks 14
PowerShell Gallery downloads 158,661
Release v3.0.5
Language: C# Updated: 2026-09-03

API Reference

Cmdlet

ConvertFrom-OfficeWordMarkdown

Aliases: ConvertFrom-WordMarkdown
Namespace PSWriteOffice
Aliases
ConvertFrom-WordMarkdown
Inputs
OfficeIMO.Markdown.MarkdownDoc System.String
Outputs
OfficeIMO.Word.WordDocument System.IO.FileInfo

Creates a Word document from Markdown.

Remarks

Returns a WordDocument or saves it to disk when -OutputPath is provided.

Examples

Authored help example

Create a .docx from Markdown text.

PS>


ConvertFrom-OfficeWordMarkdown -Markdown '# Hello' -OutputPath .\hello.docx
        

Writes a Word document containing the supplied Markdown.

Pipe a Markdown document into Word conversion.

PS>


Get-OfficeMarkdown -Path .\README.md | ConvertFrom-OfficeWordMarkdown
        

Returns a Word document instance for further edits.

Insert Markdown into a Word template bookmark.

PS>


ConvertFrom-OfficeWordMarkdown -Path .\SOP.md -TemplatePath .\Template.docx -BookmarkName MainContent -OutputPath .\SOP.docx
        

Copies the template and replaces the bookmark paragraph with generated Markdown content.

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.

Syntax

ConvertFrom-OfficeWordMarkdown [-AllowDataUriImages <Boolean>] [-AllowedImageDirectory <String[]>] [-AllowLocalImages] [-AllowRemoteImages] [-BaseUri <String>] [-BookmarkName <String>] [-ContentControlAlias <String>] [-ContentControlTag <String>] [-FitImagesToContextWidth] [-FitImagesToPageContentWidth] [-FontFamily <String>] [-KeepPlaceholder] -Markdown <String> [-MaxDataUriImageBytes <Int64>] [-MaxImageHeightPixels <Double>] [-MaxImageWidthPercentOfContent <Double>] [-MaxImageWidthPixels <Double>] [-NormalizeInput <IntelligenceXTranscript|IntelligenceXTranscriptStrict|DocsLoose>] [-Open] [-OutputPath <String>] [-PassThru] [-PreferNarrativeSingleLineDefinitions] [-Profile <OfficeIMO|CommonMark|GitHubFlavoredMarkdown|Portable>] [-ReaderOptions <MarkdownReaderOptions>] [-RenderFrontMatter] [-TemplatePath <String>] [-Theme <Plain>] [<CommonParameters>]
#
Parameter set: Markdown

Parameters

AllowDataUriImages Boolean optionalposition: namedpipeline: False
Allow data URI Markdown images to be embedded in Word output.
AllowedImageDirectory String[] optionalposition: namedpipeline: False
Restrict local images to one or more directories.
AllowLocalImages SwitchParameter optionalposition: namedpipeline: False
Allow local Markdown images to be inserted into the document.
AllowRemoteImages SwitchParameter optionalposition: namedpipeline: False
Allow remote HTTP(S) images to be downloaded and inserted.
BaseUri String optionalposition: namedpipeline: Falsealiases: BasePath
Base URI used to resolve relative links and images.
BookmarkName String optionalposition: namedpipeline: False
Bookmark name that marks where Markdown content should be inserted in the template.
ContentControlAlias String optionalposition: namedpipeline: False
Block content control alias that marks where Markdown content should be inserted in the template.
ContentControlTag String optionalposition: namedpipeline: False
Block content control tag that marks where Markdown content should be inserted in the template.
FitImagesToContextWidth SwitchParameter optionalposition: namedpipeline: False
Fit Markdown images to the current content context width.
FitImagesToPageContentWidth SwitchParameter optionalposition: namedpipeline: False
Fit Markdown images to the page content width.
FontFamily String optionalposition: namedpipeline: False
Optional font family applied during conversion.
KeepPlaceholder SwitchParameter optionalposition: namedpipeline: False
Keep the target bookmark or content-control placeholder after inserting Markdown content.
Markdown String requiredposition: 0pipeline: True (ByValue)
Markdown text to convert.
MaxDataUriImageBytes Int64 optionalposition: namedpipeline: False
Maximum decoded size for one data URI image.
MaxImageHeightPixels Double optionalposition: namedpipeline: False
Optional hard cap for Markdown image height in pixels.
MaxImageWidthPercentOfContent Double optionalposition: namedpipeline: False
Optional hard cap for Markdown image width as a percentage of available content width.
MaxImageWidthPixels Double optionalposition: namedpipeline: False
Optional hard cap for Markdown image width in pixels.
NormalizeInput MarkdownInputNormalizationPreset optionalposition: namedpipeline: Falsevalues: 3
Applies a built-in Markdown input normalization preset before parsing.
Possible values: IntelligenceXTranscript, IntelligenceXTranscriptStrict, DocsLoose
Open SwitchParameter optionalposition: namedpipeline: False
Open the document after saving.
OutputPath String optionalposition: namedpipeline: Falsealiases: OutPath
Optional output path for the .docx file.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit a FileInfo when saving to disk.
PreferNarrativeSingleLineDefinitions SwitchParameter optionalposition: namedpipeline: False
Prefer narrative paragraphs for isolated single-line definition-list patterns.
Profile MarkdownDialectProfile optionalposition: namedpipeline: Falsevalues: 4
Named Markdown reader profile used when ReaderOptions is not supplied.
Possible values: OfficeIMO, CommonMark, GitHubFlavoredMarkdown, Portable
ReaderOptions MarkdownReaderOptions optionalposition: namedpipeline: False
Optional Markdown reader options used before Word conversion.
RenderFrontMatter SwitchParameter optionalposition: namedpipeline: False
Render YAML front matter as visible Word content. Template conversions hide front matter by default.
TemplatePath String optionalposition: namedpipeline: Falsealiases: Template
Optional Word template document to copy before inserting Markdown content.
Theme OfficeVisualThemeKind optionalposition: namedpipeline: Falsevalues: 6
Shared Markdown visual theme for generated Word output.
Possible values: Plain, WordLike, TechnicalDocument, GitHubLike, Compact, Report

Outputs

OfficeIMO.Word.WordDocument, System.IO.FileInfo

ConvertFrom-OfficeWordMarkdown [-AllowDataUriImages <Boolean>] [-AllowedImageDirectory <String[]>] [-AllowLocalImages] [-AllowRemoteImages] [-BaseUri <String>] [-BookmarkName <String>] [-ContentControlAlias <String>] [-ContentControlTag <String>] [-FitImagesToContextWidth] [-FitImagesToPageContentWidth] [-FontFamily <String>] [-KeepPlaceholder] [-MaxDataUriImageBytes <Int64>] [-MaxImageHeightPixels <Double>] [-MaxImageWidthPercentOfContent <Double>] [-MaxImageWidthPixels <Double>] [-NormalizeInput <IntelligenceXTranscript|IntelligenceXTranscriptStrict|DocsLoose>] [-Open] [-OutputPath <String>] [-PassThru] -Path <String> [-PreferNarrativeSingleLineDefinitions] [-Profile <OfficeIMO|CommonMark|GitHubFlavoredMarkdown|Portable>] [-ReaderOptions <MarkdownReaderOptions>] [-RenderFrontMatter] [-TemplatePath <String>] [-Theme <Plain>] [<CommonParameters>]
#
Parameter set: Path

Parameters

AllowDataUriImages Boolean optionalposition: namedpipeline: False
Allow data URI Markdown images to be embedded in Word output.
AllowedImageDirectory String[] optionalposition: namedpipeline: False
Restrict local images to one or more directories.
AllowLocalImages SwitchParameter optionalposition: namedpipeline: False
Allow local Markdown images to be inserted into the document.
AllowRemoteImages SwitchParameter optionalposition: namedpipeline: False
Allow remote HTTP(S) images to be downloaded and inserted.
BaseUri String optionalposition: namedpipeline: Falsealiases: BasePath
Base URI used to resolve relative links and images.
BookmarkName String optionalposition: namedpipeline: False
Bookmark name that marks where Markdown content should be inserted in the template.
ContentControlAlias String optionalposition: namedpipeline: False
Block content control alias that marks where Markdown content should be inserted in the template.
ContentControlTag String optionalposition: namedpipeline: False
Block content control tag that marks where Markdown content should be inserted in the template.
FitImagesToContextWidth SwitchParameter optionalposition: namedpipeline: False
Fit Markdown images to the current content context width.
FitImagesToPageContentWidth SwitchParameter optionalposition: namedpipeline: False
Fit Markdown images to the page content width.
FontFamily String optionalposition: namedpipeline: False
Optional font family applied during conversion.
KeepPlaceholder SwitchParameter optionalposition: namedpipeline: False
Keep the target bookmark or content-control placeholder after inserting Markdown content.
MaxDataUriImageBytes Int64 optionalposition: namedpipeline: False
Maximum decoded size for one data URI image.
MaxImageHeightPixels Double optionalposition: namedpipeline: False
Optional hard cap for Markdown image height in pixels.
MaxImageWidthPercentOfContent Double optionalposition: namedpipeline: False
Optional hard cap for Markdown image width as a percentage of available content width.
MaxImageWidthPixels Double optionalposition: namedpipeline: False
Optional hard cap for Markdown image width in pixels.
NormalizeInput MarkdownInputNormalizationPreset optionalposition: namedpipeline: Falsevalues: 3
Applies a built-in Markdown input normalization preset before parsing.
Possible values: IntelligenceXTranscript, IntelligenceXTranscriptStrict, DocsLoose
Open SwitchParameter optionalposition: namedpipeline: False
Open the document after saving.
OutputPath String optionalposition: namedpipeline: Falsealiases: OutPath
Optional output path for the .docx file.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit a FileInfo when saving to disk.
Path String requiredposition: 0pipeline: Falsealiases: FilePath
Path to a Markdown file.
PreferNarrativeSingleLineDefinitions SwitchParameter optionalposition: namedpipeline: False
Prefer narrative paragraphs for isolated single-line definition-list patterns.
Profile MarkdownDialectProfile optionalposition: namedpipeline: Falsevalues: 4
Named Markdown reader profile used when ReaderOptions is not supplied.
Possible values: OfficeIMO, CommonMark, GitHubFlavoredMarkdown, Portable
ReaderOptions MarkdownReaderOptions optionalposition: namedpipeline: False
Optional Markdown reader options used before Word conversion.
RenderFrontMatter SwitchParameter optionalposition: namedpipeline: False
Render YAML front matter as visible Word content. Template conversions hide front matter by default.
TemplatePath String optionalposition: namedpipeline: Falsealiases: Template
Optional Word template document to copy before inserting Markdown content.
Theme OfficeVisualThemeKind optionalposition: namedpipeline: Falsevalues: 6
Shared Markdown visual theme for generated Word output.
Possible values: Plain, WordLike, TechnicalDocument, GitHubLike, Compact, Report

Outputs

OfficeIMO.Word.WordDocument, System.IO.FileInfo

ConvertFrom-OfficeWordMarkdown [-AllowDataUriImages <Boolean>] [-AllowedImageDirectory <String[]>] [-AllowLocalImages] [-AllowRemoteImages] [-BaseUri <String>] [-BookmarkName <String>] [-ContentControlAlias <String>] [-ContentControlTag <String>] -Document <MarkdownDoc> [-FitImagesToContextWidth] [-FitImagesToPageContentWidth] [-FontFamily <String>] [-KeepPlaceholder] [-MaxDataUriImageBytes <Int64>] [-MaxImageHeightPixels <Double>] [-MaxImageWidthPercentOfContent <Double>] [-MaxImageWidthPixels <Double>] [-NormalizeInput <IntelligenceXTranscript|IntelligenceXTranscriptStrict|DocsLoose>] [-Open] [-OutputPath <String>] [-PassThru] [-PreferNarrativeSingleLineDefinitions] [-Profile <OfficeIMO|CommonMark|GitHubFlavoredMarkdown|Portable>] [-ReaderOptions <MarkdownReaderOptions>] [-RenderFrontMatter] [-TemplatePath <String>] [-Theme <Plain>] [<CommonParameters>]
#
Parameter set: Document

Parameters

AllowDataUriImages Boolean optionalposition: namedpipeline: False
Allow data URI Markdown images to be embedded in Word output.
AllowedImageDirectory String[] optionalposition: namedpipeline: False
Restrict local images to one or more directories.
AllowLocalImages SwitchParameter optionalposition: namedpipeline: False
Allow local Markdown images to be inserted into the document.
AllowRemoteImages SwitchParameter optionalposition: namedpipeline: False
Allow remote HTTP(S) images to be downloaded and inserted.
BaseUri String optionalposition: namedpipeline: Falsealiases: BasePath
Base URI used to resolve relative links and images.
BookmarkName String optionalposition: namedpipeline: False
Bookmark name that marks where Markdown content should be inserted in the template.
ContentControlAlias String optionalposition: namedpipeline: False
Block content control alias that marks where Markdown content should be inserted in the template.
ContentControlTag String optionalposition: namedpipeline: False
Block content control tag that marks where Markdown content should be inserted in the template.
Document MarkdownDoc requiredposition: namedpipeline: True (ByValue)
Markdown document instance to convert.
FitImagesToContextWidth SwitchParameter optionalposition: namedpipeline: False
Fit Markdown images to the current content context width.
FitImagesToPageContentWidth SwitchParameter optionalposition: namedpipeline: False
Fit Markdown images to the page content width.
FontFamily String optionalposition: namedpipeline: False
Optional font family applied during conversion.
KeepPlaceholder SwitchParameter optionalposition: namedpipeline: False
Keep the target bookmark or content-control placeholder after inserting Markdown content.
MaxDataUriImageBytes Int64 optionalposition: namedpipeline: False
Maximum decoded size for one data URI image.
MaxImageHeightPixels Double optionalposition: namedpipeline: False
Optional hard cap for Markdown image height in pixels.
MaxImageWidthPercentOfContent Double optionalposition: namedpipeline: False
Optional hard cap for Markdown image width as a percentage of available content width.
MaxImageWidthPixels Double optionalposition: namedpipeline: False
Optional hard cap for Markdown image width in pixels.
NormalizeInput MarkdownInputNormalizationPreset optionalposition: namedpipeline: Falsevalues: 3
Applies a built-in Markdown input normalization preset before parsing.
Possible values: IntelligenceXTranscript, IntelligenceXTranscriptStrict, DocsLoose
Open SwitchParameter optionalposition: namedpipeline: False
Open the document after saving.
OutputPath String optionalposition: namedpipeline: Falsealiases: OutPath
Optional output path for the .docx file.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit a FileInfo when saving to disk.
PreferNarrativeSingleLineDefinitions SwitchParameter optionalposition: namedpipeline: False
Prefer narrative paragraphs for isolated single-line definition-list patterns.
Profile MarkdownDialectProfile optionalposition: namedpipeline: Falsevalues: 4
Named Markdown reader profile used when ReaderOptions is not supplied.
Possible values: OfficeIMO, CommonMark, GitHubFlavoredMarkdown, Portable
ReaderOptions MarkdownReaderOptions optionalposition: namedpipeline: False
Optional Markdown reader options used before Word conversion.
RenderFrontMatter SwitchParameter optionalposition: namedpipeline: False
Render YAML front matter as visible Word content. Template conversions hide front matter by default.
TemplatePath String optionalposition: namedpipeline: Falsealiases: Template
Optional Word template document to copy before inserting Markdown content.
Theme OfficeVisualThemeKind optionalposition: namedpipeline: Falsevalues: 6
Shared Markdown visual theme for generated Word output.
Possible values: Plain, WordLike, TechnicalDocument, GitHubLike, Compact, Report

Outputs

OfficeIMO.Word.WordDocument, System.IO.FileInfo