Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/

Convert and Publish Markdown

Edit on GitHub

Convert Markdown to styled HTML, convert HTML back to Markdown, and configure links and images for a safe publishing workflow.

Markdown is often the editable source while HTML is the delivery artifact. Keep that ownership clear: update Markdown, regenerate HTML, and avoid hand-editing both representations.

Publish HTML

Convert-OfficeDocument -To Html with New-OfficeMarkdownHtmlOptions supports fragment or document output, visual themes, CSS delivery modes, anchor links, task lists, footnotes, external-link attributes, and explicit URL or image restrictions.

$options = New-OfficeMarkdownHtmlOptions -DocumentMode -Title 'Operations runbook' -IncludeAnchorLinks
Convert-OfficeDocument -Path '.\Runbook.md' -To Html `
    -OutputPath '.\Runbook.html' -Options $options

The publish-HTML recipe creates a runbook and publishes a complete HTML document.

Bring HTML back

Use Convert-OfficeDocument -From Html -To Markdown for imported web fragments or articles. New-OfficeHtmlMarkdownOptions supplies the image policy, table limits and Markdown writer settings. Start with -Portable for portable Markdown, or use -BaseOptions to adjust a copy of existing native settings.

Example source