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-OfficeMarkdownHtml

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

Converts HTML content to Markdown.

Syntax

ConvertFrom-OfficeMarkdownHtml
[-AsDocument]
[-Base64ImageHandling <Include|Skip|SaveToFile>]
[-Base64ImageOutputDirectory <String>]
[-BaseUri <String>]
[-DropUnsupportedBlocks]
[-DropUnsupportedInlineHtml]
[-Html] <String>
[-ImageRenderingMode <RichMarkdown|PortableMarkdown|Html>]
[-IncludeDocumentChrome]
[-LineEnding <String>]
[-ListingCardMetadataMode <Preserve|SuppressInRepeatedCards>]
[-MaxInputCharacters <Int32>]
[-MaxTableExpandedColumns <Int32>]
[-Options <HtmlToMarkdownOptions>]
[-OutputPath <String>]
[-PassThru]
[-Portable]
[-PreserveScriptsAndStyles]
[-UnorderedListMarker <String>]
[-WriteOptions <MarkdownWriteOptions>]
[-WriteProfile <OfficeIMO|Portable|HtmlImage>]
[<CommonParameters>]
#
Parameter set: Html
ConvertFrom-OfficeMarkdownHtml
[-AsDocument]
[-Base64ImageHandling <Include|Skip|SaveToFile>]
[-Base64ImageOutputDirectory <String>]
[-BaseUri <String>]
[-DropUnsupportedBlocks]
[-DropUnsupportedInlineHtml]
[-ImageRenderingMode <RichMarkdown|PortableMarkdown|Html>]
[-IncludeDocumentChrome]
[-LineEnding <String>]
[-ListingCardMetadataMode <Preserve|SuppressInRepeatedCards>]
[-MaxInputCharacters <Int32>]
[-MaxTableExpandedColumns <Int32>]
[-Options <HtmlToMarkdownOptions>]
[-OutputPath <String>]
[-PassThru]
[-Path] <String>
[-Portable]
[-PreserveScriptsAndStyles]
[-UnorderedListMarker <String>]
[-WriteOptions <MarkdownWriteOptions>]
[-WriteProfile <OfficeIMO|Portable|HtmlImage>]
[<CommonParameters>]
#
Parameter set: Path

Description

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

Examples

Convert an HTML fragment to Markdown.

$markdown = ConvertFrom-OfficeMarkdownHtml -Html '<h1>Report</h1><p>Ready</p>'

Returns Markdown text converted from the supplied HTML.

Convert an HTML file to a Markdown document object.

$doc = ConvertFrom-OfficeMarkdownHtml -Path .\report.html -AsDocument

Returns a Markdown document for further editing or rendering.

Parameters

-AsDocument SwitchParameter optional
Emit a Markdown document object instead of Markdown text.
-Base64ImageHandling HtmlBase64ImageHandling optional
Controls how base64 data URI images are converted.
Possible values: Include, Skip, SaveToFile
-Base64ImageOutputDirectory String optional
Output directory for decoded base64 images when saving them to files.
-BaseUri String optional
Base URI used to resolve relative links and image sources.
-DropUnsupportedBlocks SwitchParameter optional
Drop unsupported block HTML instead of preserving it as raw HTML.
-DropUnsupportedInlineHtml SwitchParameter optional
Drop unsupported inline HTML instead of preserving it as raw HTML.
-Html String requiredposition: 0pipeline: True (ByValue)sets: Html
HTML markup to convert.
-ImageRenderingMode MarkdownImageRenderingMode optional
Controls how generated Markdown images are serialized.
Possible values: RichMarkdown, PortableMarkdown, Html
-IncludeDocumentChrome SwitchParameter optional
Convert the full HTML document instead of only body contents.
-LineEnding String optional
Markdown line ending: CRLF, LF, CR, or a literal line ending string.
-ListingCardMetadataMode HtmlListingCardMetadataMode optional
Controls whether repeated listing-card metadata is preserved or suppressed.
Possible values: Preserve, SuppressInRepeatedCards
-MaxInputCharacters Int32 optional
Maximum input length, in characters, accepted by the converter.
-MaxTableExpandedColumns Int32 optional
Maximum logical columns produced by expanding HTML table spans.
-Options HtmlToMarkdownOptions optional
Optional conversion options.
-OutputPath String optionalaliases: OutPath
Optional output path for the Markdown file.
-PassThru SwitchParameter optional
Emit a FileInfo when saving to disk.
-Portable SwitchParameter optional
Use portable Markdown output when Options is not supplied.
-PreserveScriptsAndStyles SwitchParameter optional
Preserve script, style, noscript, and template elements.
-UnorderedListMarker String optional
Unordered list marker: '-', '*', or '+'.
-WriteOptions MarkdownWriteOptions optional
Optional Markdown writer options for generated Markdown text.
-WriteProfile OfficeMarkdownWriteProfile optional
Friendly Markdown writer profile for generated Markdown text.
Possible values: OfficeIMO, Portable, HtmlImage
-Path String requiredposition: 0aliases: FilePath, InputPathsets: Path
Path to an HTML file.

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.