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

ConvertTo-OfficeMarkdownHtml

Aliases: ConvertTo-MarkdownHtml
Namespace PSWriteOffice
Aliases
ConvertTo-MarkdownHtml
Inputs
OfficeIMO.Markdown.MarkdownDoc
Outputs
System.String System.IO.FileInfo

Converts Markdown content to HTML.

Remarks

Returns HTML text or saves it to a file when -OutputPath is specified.

Examples

Authored help example

Convert a Markdown file to HTML.

PS>


$html = ConvertTo-OfficeMarkdownHtml -Path .\README.md
        

Returns the rendered HTML.

Save a styled HTML document.

PS>


ConvertTo-OfficeMarkdownHtml -Path .\Report.md -DocumentMode -Title 'Weekly Report' -Style Clean -OutputPath .\Report.html -PassThru
        

Generates a full HTML file with title and CSS styling.

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

ConvertTo-OfficeMarkdownHtml [-AllowDataUrls <Boolean>] [-AllowedHttpImageHost <String[]>] [-AllowedHttpLinkHost <String[]>] [-AllowedUrlScheme <String[]>] [-AllowMailtoUrls <Boolean>] [-AllowProtocolRelativeUrls <Boolean>] [-AssetMode <Online|Offline>] [-BaseUri <String>] [-BlockExternalHttpImages] [-CssDelivery <Inline|ExternalFile|LinkHref>] [-DisallowFileUrls <Boolean>] [-DocumentMode] [-ExternalLinksReferrerPolicy <String>] [-ExternalLinksRel <String>] [-ExternalLinksTargetBlank] [-GitHubFootnoteHtml] [-GitHubTaskListHtml] [-ImagesDecodingAsync] [-ImagesLoadingLazy] [-ImagesReferrerPolicy <String>] [-IncludeAnchorLinks] [-MaxInputCharacters <Int32>] [-NormalizeInput <IntelligenceXTranscript|IntelligenceXTranscriptStrict|DocsLoose>] [-OutputPath <String>] [-PassThru] -Path <String> [-Profile <OfficeIMO|CommonMark|GitHubFlavoredMarkdown|Portable>] [-RawHtmlHandling <Allow|Escape|Sanitize|Strip>] [-ReaderOptions <MarkdownReaderOptions>] [-RestrictHttpImagesToBaseOrigin] [-RestrictHttpLinksToBaseOrigin] [-RestrictUrlSchemes <Boolean>] [-Style <Plain>] [-Theme <Plain>] [-Title <String>] [<CommonParameters>]
#
Parameter set: Path

Parameters

AllowDataUrls Boolean optionalposition: namedpipeline: False
Allow data URLs while parsing Markdown links and images.
AllowedHttpImageHost String[] optionalposition: namedpipeline: False
Allowed HTTP(S) image hosts.
AllowedHttpLinkHost String[] optionalposition: namedpipeline: False
Allowed HTTP(S) link hosts.
AllowedUrlScheme String[] optionalposition: namedpipeline: False
Allowed URL schemes when URL scheme restriction is enabled.
AllowMailtoUrls Boolean optionalposition: namedpipeline: False
Allow mailto URLs while parsing Markdown links.
AllowProtocolRelativeUrls Boolean optionalposition: namedpipeline: False
Allow protocol-relative URLs while parsing Markdown links and images.
AssetMode AssetMode optionalposition: namedpipeline: Falsevalues: 2
Asset loading mode.
Possible values: Online, Offline
BaseUri String optionalposition: namedpipeline: False
Base URI used to resolve and restrict relative Markdown links and images.
BlockExternalHttpImages SwitchParameter optionalposition: namedpipeline: False
Block all absolute external HTTP(S) images.
CssDelivery CssDelivery optionalposition: namedpipeline: Falsevalues: 3
CSS delivery mode.
Possible values: Inline, ExternalFile, LinkHref
DisallowFileUrls Boolean optionalposition: namedpipeline: False
Block file URLs while parsing Markdown links and images.
DocumentMode SwitchParameter optionalposition: namedpipeline: False
Render a full HTML document instead of a fragment.
ExternalLinksReferrerPolicy String optionalposition: namedpipeline: False
referrerpolicy value for external HTTP(S) links.
ExternalLinksRel String optionalposition: namedpipeline: False
rel attribute value for external HTTP(S) links.
ExternalLinksTargetBlank SwitchParameter optionalposition: namedpipeline: False
Open external HTTP(S) links in a new tab.
GitHubFootnoteHtml SwitchParameter optionalposition: namedpipeline: False
Emit GitHub-compatible footnote HTML.
GitHubTaskListHtml SwitchParameter optionalposition: namedpipeline: False
Emit GitHub-compatible task-list HTML.
ImagesDecodingAsync SwitchParameter optionalposition: namedpipeline: False
Add decoding="async" to rendered images.
ImagesLoadingLazy SwitchParameter optionalposition: namedpipeline: False
Add loading="lazy" to rendered images.
ImagesReferrerPolicy String optionalposition: namedpipeline: False
referrerpolicy value for rendered images.
IncludeAnchorLinks SwitchParameter optionalposition: namedpipeline: False
Add anchor links to headings.
MaxInputCharacters Int32 optionalposition: namedpipeline: False
Maximum Markdown input length accepted by the reader.
NormalizeInput MarkdownInputNormalizationPreset optionalposition: namedpipeline: Falsevalues: 3
Applies a built-in Markdown input normalization preset before parsing.
Possible values: IntelligenceXTranscript, IntelligenceXTranscriptStrict, DocsLoose
OutputPath String optionalposition: namedpipeline: Falsealiases: OutPath
Optional output path for the HTML file.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit a FileInfo when saving to disk.
Path String requiredposition: 0pipeline: Falsealiases: FilePath, InputPath
Path to the Markdown file.
Profile MarkdownDialectProfile optionalposition: namedpipeline: Falsevalues: 4
Named reader profile used when ReaderOptions is not supplied.
Possible values: OfficeIMO, CommonMark, GitHubFlavoredMarkdown, Portable
RawHtmlHandling RawHtmlHandling optionalposition: namedpipeline: Falsevalues: 4
Controls how raw HTML blocks are emitted.
Possible values: Allow, Escape, Sanitize, Strip
ReaderOptions MarkdownReaderOptions optionalposition: namedpipeline: False
Optional reader options when parsing Markdown.
RestrictHttpImagesToBaseOrigin SwitchParameter optionalposition: namedpipeline: False
Restrict absolute HTTP(S) images to the base origin.
RestrictHttpLinksToBaseOrigin SwitchParameter optionalposition: namedpipeline: False
Restrict absolute HTTP(S) links to the base origin.
RestrictUrlSchemes Boolean optionalposition: namedpipeline: False
Restrict parsed URL schemes to the allow-list.
Style HtmlStyle optionalposition: namedpipeline: Falsevalues: 9
Built-in HTML style preset.
Possible values: Plain, Clean, GithubLight, GithubDark, GithubAuto, ChatLight, ChatDark, ChatAuto, Word
Theme OfficeVisualThemeKind optionalposition: namedpipeline: Falsevalues: 6
Shared Markdown visual theme for HTML output.
Possible values: Plain, WordLike, TechnicalDocument, GitHubLike, Compact, Report
Title String optionalposition: namedpipeline: False
Optional title for HTML documents.

Outputs

System.String, System.IO.FileInfo

ConvertTo-OfficeMarkdownHtml [-AllowDataUrls <Boolean>] [-AllowedHttpImageHost <String[]>] [-AllowedHttpLinkHost <String[]>] [-AllowedUrlScheme <String[]>] [-AllowMailtoUrls <Boolean>] [-AllowProtocolRelativeUrls <Boolean>] [-AssetMode <Online|Offline>] [-BaseUri <String>] [-BlockExternalHttpImages] [-CssDelivery <Inline|ExternalFile|LinkHref>] [-DisallowFileUrls <Boolean>] [-DocumentMode] [-ExternalLinksReferrerPolicy <String>] [-ExternalLinksRel <String>] [-ExternalLinksTargetBlank] [-GitHubFootnoteHtml] [-GitHubTaskListHtml] [-ImagesDecodingAsync] [-ImagesLoadingLazy] [-ImagesReferrerPolicy <String>] [-IncludeAnchorLinks] [-MaxInputCharacters <Int32>] [-NormalizeInput <IntelligenceXTranscript|IntelligenceXTranscriptStrict|DocsLoose>] [-OutputPath <String>] [-PassThru] [-Profile <OfficeIMO|CommonMark|GitHubFlavoredMarkdown|Portable>] [-RawHtmlHandling <Allow|Escape|Sanitize|Strip>] [-ReaderOptions <MarkdownReaderOptions>] [-RestrictHttpImagesToBaseOrigin] [-RestrictHttpLinksToBaseOrigin] [-RestrictUrlSchemes <Boolean>] [-Style <Plain>] -Text <String> [-Theme <Plain>] [-Title <String>] [<CommonParameters>]
#
Parameter set: Text

Parameters

AllowDataUrls Boolean optionalposition: namedpipeline: False
Allow data URLs while parsing Markdown links and images.
AllowedHttpImageHost String[] optionalposition: namedpipeline: False
Allowed HTTP(S) image hosts.
AllowedHttpLinkHost String[] optionalposition: namedpipeline: False
Allowed HTTP(S) link hosts.
AllowedUrlScheme String[] optionalposition: namedpipeline: False
Allowed URL schemes when URL scheme restriction is enabled.
AllowMailtoUrls Boolean optionalposition: namedpipeline: False
Allow mailto URLs while parsing Markdown links.
AllowProtocolRelativeUrls Boolean optionalposition: namedpipeline: False
Allow protocol-relative URLs while parsing Markdown links and images.
AssetMode AssetMode optionalposition: namedpipeline: Falsevalues: 2
Asset loading mode.
Possible values: Online, Offline
BaseUri String optionalposition: namedpipeline: False
Base URI used to resolve and restrict relative Markdown links and images.
BlockExternalHttpImages SwitchParameter optionalposition: namedpipeline: False
Block all absolute external HTTP(S) images.
CssDelivery CssDelivery optionalposition: namedpipeline: Falsevalues: 3
CSS delivery mode.
Possible values: Inline, ExternalFile, LinkHref
DisallowFileUrls Boolean optionalposition: namedpipeline: False
Block file URLs while parsing Markdown links and images.
DocumentMode SwitchParameter optionalposition: namedpipeline: False
Render a full HTML document instead of a fragment.
ExternalLinksReferrerPolicy String optionalposition: namedpipeline: False
referrerpolicy value for external HTTP(S) links.
ExternalLinksRel String optionalposition: namedpipeline: False
rel attribute value for external HTTP(S) links.
ExternalLinksTargetBlank SwitchParameter optionalposition: namedpipeline: False
Open external HTTP(S) links in a new tab.
GitHubFootnoteHtml SwitchParameter optionalposition: namedpipeline: False
Emit GitHub-compatible footnote HTML.
GitHubTaskListHtml SwitchParameter optionalposition: namedpipeline: False
Emit GitHub-compatible task-list HTML.
ImagesDecodingAsync SwitchParameter optionalposition: namedpipeline: False
Add decoding="async" to rendered images.
ImagesLoadingLazy SwitchParameter optionalposition: namedpipeline: False
Add loading="lazy" to rendered images.
ImagesReferrerPolicy String optionalposition: namedpipeline: False
referrerpolicy value for rendered images.
IncludeAnchorLinks SwitchParameter optionalposition: namedpipeline: False
Add anchor links to headings.
MaxInputCharacters Int32 optionalposition: namedpipeline: False
Maximum Markdown input length accepted by the reader.
NormalizeInput MarkdownInputNormalizationPreset optionalposition: namedpipeline: Falsevalues: 3
Applies a built-in Markdown input normalization preset before parsing.
Possible values: IntelligenceXTranscript, IntelligenceXTranscriptStrict, DocsLoose
OutputPath String optionalposition: namedpipeline: Falsealiases: OutPath
Optional output path for the HTML file.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit a FileInfo when saving to disk.
Profile MarkdownDialectProfile optionalposition: namedpipeline: Falsevalues: 4
Named reader profile used when ReaderOptions is not supplied.
Possible values: OfficeIMO, CommonMark, GitHubFlavoredMarkdown, Portable
RawHtmlHandling RawHtmlHandling optionalposition: namedpipeline: Falsevalues: 4
Controls how raw HTML blocks are emitted.
Possible values: Allow, Escape, Sanitize, Strip
ReaderOptions MarkdownReaderOptions optionalposition: namedpipeline: False
Optional reader options when parsing Markdown.
RestrictHttpImagesToBaseOrigin SwitchParameter optionalposition: namedpipeline: False
Restrict absolute HTTP(S) images to the base origin.
RestrictHttpLinksToBaseOrigin SwitchParameter optionalposition: namedpipeline: False
Restrict absolute HTTP(S) links to the base origin.
RestrictUrlSchemes Boolean optionalposition: namedpipeline: False
Restrict parsed URL schemes to the allow-list.
Style HtmlStyle optionalposition: namedpipeline: Falsevalues: 9
Built-in HTML style preset.
Possible values: Plain, Clean, GithubLight, GithubDark, GithubAuto, ChatLight, ChatDark, ChatAuto, Word
Text String requiredposition: namedpipeline: False
Markdown text to convert.
Theme OfficeVisualThemeKind optionalposition: namedpipeline: Falsevalues: 6
Shared Markdown visual theme for HTML output.
Possible values: Plain, WordLike, TechnicalDocument, GitHubLike, Compact, Report
Title String optionalposition: namedpipeline: False
Optional title for HTML documents.

Outputs

System.String, System.IO.FileInfo

ConvertTo-OfficeMarkdownHtml [-AllowDataUrls <Boolean>] [-AllowedHttpImageHost <String[]>] [-AllowedHttpLinkHost <String[]>] [-AllowedUrlScheme <String[]>] [-AllowMailtoUrls <Boolean>] [-AllowProtocolRelativeUrls <Boolean>] [-AssetMode <Online|Offline>] [-BaseUri <String>] [-BlockExternalHttpImages] [-CssDelivery <Inline|ExternalFile|LinkHref>] [-DisallowFileUrls <Boolean>] -Document <MarkdownDoc> [-DocumentMode] [-ExternalLinksReferrerPolicy <String>] [-ExternalLinksRel <String>] [-ExternalLinksTargetBlank] [-GitHubFootnoteHtml] [-GitHubTaskListHtml] [-ImagesDecodingAsync] [-ImagesLoadingLazy] [-ImagesReferrerPolicy <String>] [-IncludeAnchorLinks] [-MaxInputCharacters <Int32>] [-NormalizeInput <IntelligenceXTranscript|IntelligenceXTranscriptStrict|DocsLoose>] [-OutputPath <String>] [-PassThru] [-Profile <OfficeIMO|CommonMark|GitHubFlavoredMarkdown|Portable>] [-RawHtmlHandling <Allow|Escape|Sanitize|Strip>] [-ReaderOptions <MarkdownReaderOptions>] [-RestrictHttpImagesToBaseOrigin] [-RestrictHttpLinksToBaseOrigin] [-RestrictUrlSchemes <Boolean>] [-Style <Plain>] [-Theme <Plain>] [-Title <String>] [<CommonParameters>]
#
Parameter set: Document

Parameters

AllowDataUrls Boolean optionalposition: namedpipeline: False
Allow data URLs while parsing Markdown links and images.
AllowedHttpImageHost String[] optionalposition: namedpipeline: False
Allowed HTTP(S) image hosts.
AllowedHttpLinkHost String[] optionalposition: namedpipeline: False
Allowed HTTP(S) link hosts.
AllowedUrlScheme String[] optionalposition: namedpipeline: False
Allowed URL schemes when URL scheme restriction is enabled.
AllowMailtoUrls Boolean optionalposition: namedpipeline: False
Allow mailto URLs while parsing Markdown links.
AllowProtocolRelativeUrls Boolean optionalposition: namedpipeline: False
Allow protocol-relative URLs while parsing Markdown links and images.
AssetMode AssetMode optionalposition: namedpipeline: Falsevalues: 2
Asset loading mode.
Possible values: Online, Offline
BaseUri String optionalposition: namedpipeline: False
Base URI used to resolve and restrict relative Markdown links and images.
BlockExternalHttpImages SwitchParameter optionalposition: namedpipeline: False
Block all absolute external HTTP(S) images.
CssDelivery CssDelivery optionalposition: namedpipeline: Falsevalues: 3
CSS delivery mode.
Possible values: Inline, ExternalFile, LinkHref
DisallowFileUrls Boolean optionalposition: namedpipeline: False
Block file URLs while parsing Markdown links and images.
Document MarkdownDoc requiredposition: namedpipeline: True (ByValue)
Markdown document to convert.
DocumentMode SwitchParameter optionalposition: namedpipeline: False
Render a full HTML document instead of a fragment.
ExternalLinksReferrerPolicy String optionalposition: namedpipeline: False
referrerpolicy value for external HTTP(S) links.
ExternalLinksRel String optionalposition: namedpipeline: False
rel attribute value for external HTTP(S) links.
ExternalLinksTargetBlank SwitchParameter optionalposition: namedpipeline: False
Open external HTTP(S) links in a new tab.
GitHubFootnoteHtml SwitchParameter optionalposition: namedpipeline: False
Emit GitHub-compatible footnote HTML.
GitHubTaskListHtml SwitchParameter optionalposition: namedpipeline: False
Emit GitHub-compatible task-list HTML.
ImagesDecodingAsync SwitchParameter optionalposition: namedpipeline: False
Add decoding="async" to rendered images.
ImagesLoadingLazy SwitchParameter optionalposition: namedpipeline: False
Add loading="lazy" to rendered images.
ImagesReferrerPolicy String optionalposition: namedpipeline: False
referrerpolicy value for rendered images.
IncludeAnchorLinks SwitchParameter optionalposition: namedpipeline: False
Add anchor links to headings.
MaxInputCharacters Int32 optionalposition: namedpipeline: False
Maximum Markdown input length accepted by the reader.
NormalizeInput MarkdownInputNormalizationPreset optionalposition: namedpipeline: Falsevalues: 3
Applies a built-in Markdown input normalization preset before parsing.
Possible values: IntelligenceXTranscript, IntelligenceXTranscriptStrict, DocsLoose
OutputPath String optionalposition: namedpipeline: Falsealiases: OutPath
Optional output path for the HTML file.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit a FileInfo when saving to disk.
Profile MarkdownDialectProfile optionalposition: namedpipeline: Falsevalues: 4
Named reader profile used when ReaderOptions is not supplied.
Possible values: OfficeIMO, CommonMark, GitHubFlavoredMarkdown, Portable
RawHtmlHandling RawHtmlHandling optionalposition: namedpipeline: Falsevalues: 4
Controls how raw HTML blocks are emitted.
Possible values: Allow, Escape, Sanitize, Strip
ReaderOptions MarkdownReaderOptions optionalposition: namedpipeline: False
Optional reader options when parsing Markdown.
RestrictHttpImagesToBaseOrigin SwitchParameter optionalposition: namedpipeline: False
Restrict absolute HTTP(S) images to the base origin.
RestrictHttpLinksToBaseOrigin SwitchParameter optionalposition: namedpipeline: False
Restrict absolute HTTP(S) links to the base origin.
RestrictUrlSchemes Boolean optionalposition: namedpipeline: False
Restrict parsed URL schemes to the allow-list.
Style HtmlStyle optionalposition: namedpipeline: Falsevalues: 9
Built-in HTML style preset.
Possible values: Plain, Clean, GithubLight, GithubDark, GithubAuto, ChatLight, ChatDark, ChatAuto, Word
Theme OfficeVisualThemeKind optionalposition: namedpipeline: Falsevalues: 6
Shared Markdown visual theme for HTML output.
Possible values: Plain, WordLike, TechnicalDocument, GitHubLike, Compact, Report
Title String optionalposition: namedpipeline: False
Optional title for HTML documents.

Outputs

System.String, System.IO.FileInfo