OfficeIMO.Word.Markdown
3.6.1
Prefix Reserved
dotnet add package OfficeIMO.Word.Markdown --version 3.6.1
NuGet\Install-Package OfficeIMO.Word.Markdown -Version 3.6.1
<PackageReference Include="OfficeIMO.Word.Markdown" Version="3.6.1" />
<PackageVersion Include="OfficeIMO.Word.Markdown" Version="3.6.1" />
<PackageReference Include="OfficeIMO.Word.Markdown" />
paket add OfficeIMO.Word.Markdown --version 3.6.1
#r "nuget: OfficeIMO.Word.Markdown, 3.6.1"
#:package OfficeIMO.Word.Markdown@3.6.1
#addin nuget:?package=OfficeIMO.Word.Markdown&version=3.6.1
#tool nuget:?package=OfficeIMO.Word.Markdown&version=3.6.1
OfficeIMO.Word.Markdown - Word and Markdown conversion
OfficeIMO.Word.Markdown converts between OfficeIMO.Word documents and OfficeIMO.Markdown documents.
Install
dotnet add package OfficeIMO.Word.Markdown
Quick start
using OfficeIMO.Markdown;
using OfficeIMO.Word;
using OfficeIMO.Word.Markdown;
using var document = WordDocument.Create();
document.AddParagraph("Hello");
using MarkdownDocument model = document.ToMarkdown();
string markdown = model.ToMarkdown();
using var fromMarkdown = MarkdownDocument.Parse("# Title\n\nBody").ToWord();
AST-first conversion
using OfficeIMO.Markdown;
using OfficeIMO.Markdown.Html;
using OfficeIMO.Word.Markdown;
using MarkdownDocument markdownDocument = OfficeIMO.Html.HtmlConversionDocument
.Parse("<table><tr><td><p>Line 1</p><p>Line 2</p></td></tr></table>")
.ToMarkdown();
using var wordDocument = markdownDocument.ToWord();
Use MarkdownDocument.ToWord() when you already have a typed AST and want to avoid flattening back to Markdown text before Word conversion.
For staged parsing, use the import options to configure the Markdown reader before preparing images or converting into a template:
string source = "# Report\n\nPrepared from Markdown.";
var options = new MarkdownWordExportOptions();
using var markdown = MarkdownDocument.Parse(source, options.CreateReaderOptions());
using WordDocument document = markdown.ToWord(options);
The factory returns a fresh reader configuration with the Word semantic fences and import settings applied.
What it maps
Markdown-to-Word tables use plain native formatting and keep authored column
alignment by default. Pass MarkdownWordExportOptions.Theme or set
ApplyDefaultTheme = true to add OfficeIMO table decoration and inferred numeric
alignment.
- Word to Markdown with headings, paragraphs, lists, task items, tables, images, links, code, footnotes, and GitHub-friendly output.
- Markdown to Word through the typed
OfficeIMO.Markdownmodel. - Markdown image layout options such as local-image allowance and page-content-width fitting.
- Selected AST-preserved inline HTML wrappers such as underline, superscript, and subscript into Word run formatting.
HTML via Markdown
Convert Word into a Markdown model, then render it with Markdown's HTML options:
using OfficeIMO.Markdown;
using OfficeIMO.Word.Markdown;
using var source = OfficeIMO.Word.WordDocument.Load("report.docx");
using var markdown = source.ToMarkdown();
string html = markdown.ToHtml(new MarkdownHtmlExportOptions {
Kind = MarkdownHtmlKind.Document,
Style = MarkdownHtmlStyle.Word
});
markdown.SaveAsHtml("report.html", new MarkdownHtmlExportOptions {
Kind = MarkdownHtmlKind.Document,
Style = MarkdownHtmlStyle.GithubAuto
});
For HTML input, add OfficeIMO.Markdown.Html, parse with HtmlConversionDocument.Parse(html), then call ToMarkdown().ToWord(). OfficeIMO.Word.Markdown has no dependency on the HTML engine. The OfficeIMO front door wires optional raw-HTML handling; a focused adapter reports unsupported raw blocks through its conversion diagnostics.
Notes
- Select
MarkdownHtmlStyle.Wordexplicitly for document-like HTML styling. - TOC markers:
[TOC],[[TOC]],{:toc}, and `` are recognized. Markdown → Word creates a native Word table of contents, and Word → Markdown exports native TOCs back as[TOC ...]markers. Parameterized form:[TOC min=2 max=3 layout=sidebar-right sticky=true scrollspy=true title="On this page"]. - Table cells: inline markdown (code/links/emphasis/images) is supported and
<br>becomes a real line break in HTML. - Native Markdown tables cannot express merged Word cells or cell borders. Word-to-Markdown keeps their text in a flat table and reports the formatting loss through
ToMarkdown(options, out report). - AST-preserved inline HTML wrappers such as
<u>,<sub>, and<sup>map to real Word run formatting during Markdown → Word conversion. - Inline tags without a native Word run equivalent degrade intentionally on the Word leg:
<ins>is treated as underline semantics and<q>roundtrips as literal quoted text.
Markdown → Word image layout options
using OfficeIMO.Markdown;
using OfficeIMO.Word.Markdown;
var options = new MarkdownWordExportOptions {
AllowLocalImages = true,
FitImagesToPageContentWidth = true, // page width minus margins
MaxImageWidth = OfficeIMO.OfficeLength.Inches(5), // optional physical cap
MaxImageWidthPercentOfContent = 85 // optional percent-based cap
};
using var doc = MarkdownDocument.Parse("# Report\n\nBody").ToWord(options);
- Typed contract is available via
MarkdownWordExportOptions.ImageLayout. PreferNarrativeSingleLineDefinitions = truekeeps isolatedLabel: valuelines as narrative paragraphs while still allowing grouped definition-list blocks.OnImageLayoutDiagnosticreports requested, natural, effective-limit, and final dimensions as nullableOfficeLengthvalues. Natural image pixels are interpreted at 96 DPI; useToPixels()for that projection orToPoints()for points.
Word → Markdown layout and visual fallback options
using OfficeIMO.Markdown;
var options = new WordMarkdownExportOptions {
PageBreakMode = WordMarkdownPageBreakMode.SemanticBlock,
UnsupportedContentMode = WordMarkdownUnsupportedContentMode.Placeholder,
VisualFallbackMode = WordMarkdownVisualFallbackMode.SvgFile
};
doc.SaveAsMarkdown("report.md", options);
PageBreakMode.SemanticBlockwrites page breaks as fenced semantic blocks so Markdown → Word can restore real Word page breaks.- Set
IncludeHeadersAndFootersAsSemanticBlocks = trueto export running content as semantic Markdown blocks. Omitted running content and explicit page breaks remain visible as omission diagnostics, including when the selected policy suppresses warning text. Native Word table-of-contents fields use semantic markers where supported. VisualFallbackMode.SvgDataUriembeds supported Word chart snapshots directly in Markdown as SVG images.VisualFallbackMode.SvgFilewrites supported chart snapshots into a sidecar*.assetsdirectory next to the Markdown file and links to those files. File images and SVG sidecars are staged until loss acceptance;FailOnLossleaves existing Markdown and assets unchanged when the report is rejected.- Chart SVG fallbacks use the shared Word chart projection. They preserve supported cached values, numeric X coordinates, bubble sizes, category combinations and secondary-axis assignments, dimensions, native plotting order, series and point styles, radial geometry, basic label content, surfaces, axes, and resolved fonts. Secondary scales are automatic; unsupported native settings remain semantic placeholders when
UnsupportedContentMode.Placeholderis enabled.
Explicit IntelligenceX transcript contract
using OfficeIMO;
using OfficeIMO.Markdown;
using OfficeIMO.Word.Markdown;
var options = MarkdownWordExportOptions.CreateIntelligenceXTranscript(
allowedImageDirectories: new[] { @"C:\Exports\Images" },
visualMaxWidth: OfficeLength.Pixels(760));
using var doc = MarkdownDocument.Parse("# Report\n\nBody").ToWord(options);
MarkdownWordExportOptions.CreateIntelligenceXTranscript(...)is the explicit DOCX preset for IX transcript export.- That preset now reuses the shared
MarkdownTranscriptPreparation.CreateIntelligenceXTranscriptReaderOptions(...)contract, including legacy IX visual JSON upgrades through document transforms. MarkdownToWordCapabilities.PreservesNarrativeSingleLineDefinitionsAsSeparateParagraphs()exposes the groupedLabel: valuecapability probe as a reusable OfficeIMO contract instead of host-local reflection logic.
Supported features (core)
- Headings 1–6, paragraphs, hard breaks
- Lists (unordered, ordered) and task items
- Tables with per‑column alignment
- Images (alt/title; size hints when provided in Markdown)
- Links and autolinks
- Code spans/blocks
- AST-preserved inline HTML wrappers for underline, superscript, and subscript
- Footnotes
- Front matter passthrough when using OfficeIMO.Markdown model
Boundaries
- Word document modeling belongs in
OfficeIMO.Word. - Markdown parsing and AST behavior belongs in
OfficeIMO.Markdown. - HTML ingestion belongs in
OfficeIMO.Markdown.HtmlorOfficeIMO.Word.Html, depending on the desired source model. - PDF output belongs in
OfficeIMO.Word.PdfandOfficeIMO.Pdf.
Targets and license
- Targets:
netstandard2.0,net8.0,net10.0. - License: MIT.
- Repository: EvotecIT/OfficeIMO
Dependency footprint
- External: None beyond the dependencies of its OfficeIMO format packages.
- OfficeIMO:
OfficeIMO.Word,OfficeIMO.Markdown,OfficeIMO.Markdown.Html,OfficeIMO.Word.Html, andOfficeIMO.Core.
See the complete OfficeIMO package map for related formats and conversion paths.
Generated capability summary
This table is generated from the package-neutral OfficeIMO operation catalog. The detailed source contracts remain authoritative for feature-level behavior and limitations.
| Operation | Supported | Partial | Preserved | Rejected | Unsupported | Not applicable |
|---|---|---|---|---|---|---|
| Convert | 2 | 0 | 0 | 0 | 0 | 0 |
The complete rows for OfficeIMO.Word.Markdown are published in the generated operation contract.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
- OfficeIMO.Core (>= 3.6.1)
- OfficeIMO.Markdown (>= 3.6.1)
- OfficeIMO.Word (>= 3.6.1)
-
.NETStandard 2.0
- OfficeIMO.Core (>= 3.6.1)
- OfficeIMO.Markdown (>= 3.6.1)
- OfficeIMO.Word (>= 3.6.1)
-
net10.0
- OfficeIMO.Core (>= 3.6.1)
- OfficeIMO.Markdown (>= 3.6.1)
- OfficeIMO.Word (>= 3.6.1)
-
net8.0
- OfficeIMO.Core (>= 3.6.1)
- OfficeIMO.Markdown (>= 3.6.1)
- OfficeIMO.Word (>= 3.6.1)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on OfficeIMO.Word.Markdown:
| Package | Downloads |
|---|---|
|
Ank.DocToolkit
Convert HTML to PDF and DOCX in C# without a browser - pure managed, no Chromium, no wkhtmltopdf, no native binaries, no LibreOffice, no Office interop. Also converts Markdown to DOCX and PDF; renders DOCX, XLSX and PPTX to PDF; exports DOCX to HTML/Markdown and XLSX to CSV/HTML; reads legacy Word 97-2003 .doc files; reads text out of a PDF; creates/edits DOCX, XLSX and PPTX; password-protects PDF, DOCX, XLSX and PPTX; and inspects and validates digital signatures in DOCX, XLSX and PPTX. Runs on Linux, Windows, macOS and arm64, and makes no network calls at runtime. |
|
|
OfficeIMO.Reader
Unified, read-only document extraction facade for OfficeIMO (Word/Excel/PowerPoint/Markdown/PDF) intended for AI ingestion. |
|
|
OfficeIMO
Document conversion and resumable batches over the OfficeIMO format libraries. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on OfficeIMO.Word.Markdown:
| Repository | Stars |
|---|---|
|
EvotecIT/PSWriteOffice
Moved to OfficeIMO. Development, releases, issues and pull requests: https://github.com/EvotecIT/OfficeIMO
|
| Version | Downloads | Last Updated |
|---|---|---|
| 3.6.1 | 0 | 11/10/2026 |
| 3.6.0 | 112 | 11/6/2026 |
| 3.5.3 | 255 | 10/31/2026 |
| 3.5.2 | 655 | 10/24/2026 |
| 3.5.1 | 673 | 10/16/2026 |
| 3.4.5 | 631 | 10/10/2026 |
| 3.4.4 | 287 | 9/27/2026 |
| 3.4.3 | 523 | 9/12/2026 |
| 3.4.2 | 189 | 9/9/2026 |
| 3.4.1 | 207 | 9/7/2026 |
| 3.4.0 | 179 | 9/6/2026 |
| 3.3.0 | 131 | 9/2/2026 |
| 3.2.7 | 130 | 8/29/2026 |
| 3.2.6 | 3,605 | 8/22/2026 |
| 3.2.5 | 237 | 8/21/2026 |
| 3.2.4 | 227 | 8/19/2026 |
| 3.2.3 | 132 | 8/17/2026 |
| 3.2.2 | 2,795 | 8/13/2026 |
| 3.2.1 | 306 | 8/11/2026 |
| 3.2.0 | 2,409 | 8/7/2026 |