Project

PSWriteOffice

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

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

ConvertFrom-OfficeWordMarkdown

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

Creates a Word document from Markdown.

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 <OfficeVisualThemeKind>]
[<CommonParameters>]
#
Parameter set: Markdown
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 <OfficeVisualThemeKind>]
[<CommonParameters>]
#
Parameter set: Path
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 <OfficeVisualThemeKind>]
[<CommonParameters>]
#
Parameter set: Document

Description

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

Examples

Create a .docx from Markdown text.

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

Writes a Word document containing the supplied Markdown.

Pipe a Markdown document into Word conversion.

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

Returns a Word document instance for further edits.

Insert Markdown into a Word template bookmark.

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.

Parameters

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

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.