OfficeIMO.Markdown.Html
3.0.3
Prefix Reserved
dotnet add package OfficeIMO.Markdown.Html --version 3.0.3
NuGet\Install-Package OfficeIMO.Markdown.Html -Version 3.0.3
<PackageReference Include="OfficeIMO.Markdown.Html" Version="3.0.3" />
<PackageVersion Include="OfficeIMO.Markdown.Html" Version="3.0.3" />
<PackageReference Include="OfficeIMO.Markdown.Html" />
paket add OfficeIMO.Markdown.Html --version 3.0.3
#r "nuget: OfficeIMO.Markdown.Html, 3.0.3"
#:package OfficeIMO.Markdown.Html@3.0.3
#addin nuget:?package=OfficeIMO.Markdown.Html&version=3.0.3
#tool nuget:?package=OfficeIMO.Markdown.Html&version=3.0.3
OfficeIMO.Markdown.Html - HTML to Markdown conversion
OfficeIMO.Markdown.Html converts HTML fragments or full HTML documents into Markdown text and OfficeIMO.Markdown document models.
Install
dotnet add package OfficeIMO.Markdown.Html
Quick start
using OfficeIMO.Markdown;
using OfficeIMO.Html;
using OfficeIMO.Markdown.Html;
HtmlConversionDocument source = HtmlConversionDocument.Parse("<h1>Hello</h1><p>Body</p>");
string markdown = source.ToMarkdown();
MarkdownDoc document = source.ToMarkdownDocument();
For multi-target workflows, prepare HTML once and reuse its normalized DOM:
using OfficeIMO.Html;
HtmlConversionDocument source = HtmlConversionDocumentBuilder.Build(html);
string markdown = source.ToMarkdown();
MarkdownDoc document = source.ToMarkdownDocument();
Create a prepared document with HtmlConversionDocument.Parse(...), Load(...), or LoadAsync(...); all three enter through the same bounded parser. Save Markdown through the prepared document's path, stream, and async SaveAsMarkdown methods. Adapter-local filtering works on a clone, so converting to Markdown does not mutate the document consumed by Word, RTF, PDF, or image output.
Options
using OfficeIMO.Markdown.Html;
var options = new HtmlToMarkdownOptions {
BaseUri = new Uri("https://example.com/docs/"),
UseBodyContentsOnly = true,
PreserveUnsupportedBlocks = true,
PreserveUnsupportedInlineHtml = true,
SmartHref = true
};
HtmlConversionDocument source = HtmlConversionDocument.Parse("<p><a href=\"guide/start\">Docs</a></p>");
string markdown = source.ToMarkdown(options);
Compatibility controls
var options = new HtmlToMarkdownOptions {
SmartHref = true,
UnknownBlockHandling = HtmlUnknownTagHandling.Bypass,
UnknownInlineHandling = HtmlUnknownTagHandling.Bypass
};
options.ExcludeSelectors.Add(".ad, .cookie-banner");
options.TagAliases["highlight"] = "mark";
options.PassThroughTags.Add("custom-widget");
HtmlConversionDocument source = HtmlConversionDocument.Parse(html);
string markdown = source.ToMarkdown(options);
SmartHrefemits self-describing links such as<a href="https://example.com">https://example.com</a>as plain text.ExcludeSelectorsandElementFiltersremove matching HTML before conversion.TagAliaseslets custom or legacy tag names reuse built-in converters.PassThroughTagspreserves selected elements as raw HTML.UnknownBlockHandlingandUnknownInlineHandlingchoose whether unknown elements are preserved, bypassed, dropped, or rejected.
What it maps
- Headings, paragraphs, ordered and unordered lists, block quotes, code blocks, horizontal rules, tables, images, figures, details/summary, definition lists, and raw HTML fallback blocks.
- Emphasis, strong emphasis, strike-through, code spans, links, images, line breaks, and selected inline HTML wrappers.
- Native and ARIA headings, accessible link/image names, ordered-list marker families, reversed lists, item value resets, and code-language hints. Generated Markdown uses decimal CommonMark markers while the typed list retains the original HTML marker family for HTML projection.
- Local EPUB/DPUB-ARIA footnotes and GitHub-style footnote sections as typed
FootnoteRefInlineandFootnoteDefinitionBlocknodes, including structured definition bodies. - Relative links and image targets when a base URI is supplied.
- Shared
data-omd-*visual host elements back into semantic fenced blocks when host hints are registered. - Custom block and inline converters for host or plug-in packages.
EPUB footnote references are converted only when their target is an actual footnote, endnote, or rearnote definition in the same HTML document. Generic epub:type="note" content stays ordinary content. Cross-document note links remain ordinary links so the converter does not invent a local definition. Footnote backlinks are omitted from Markdown. Accessible names use a deterministic conversion subset: aria-labelledby, aria-label, host-language alternatives such as image alt, optional visible text, and title fallback.
Profiles
- Use the OfficeIMO profile when the downstream consumer is
OfficeIMO.MarkdownorOfficeIMO.MarkdownRenderer. - Use the GitHub Flavored Markdown profile for README and GitHub documentation output.
- Use the CommonMark profile when output should avoid GitHub-only constructs such as pipe tables; HTML tables are emitted as raw HTML.
- Use the portable profile when output should remain friendly to generic Markdown engines.
var github = HtmlToMarkdownOptions.CreateGitHubFlavoredMarkdownProfile();
string readme = HtmlConversionDocument
.Parse("<p><a href=\"https://example.com\">https://example.com</a></p>")
.ToMarkdown(github);
var commonMark = HtmlToMarkdownOptions.CreateCommonMarkProfile();
string portableTable = HtmlConversionDocument
.Parse("<table><tr><th>Name</th></tr><tr><td>Value</td></tr></table>")
.ToMarkdown(commonMark);
Boundaries
- This package owns HTML ingestion into Markdown.
- It does not render Markdown to a host shell; that belongs in
OfficeIMO.MarkdownRenderer. - It does not export to PDF; that belongs in
OfficeIMO.Markdown.PdfandOfficeIMO.Pdf.
Targets and license
- Targets:
netstandard2.0,net8.0,net10.0. - License: MIT.
- Repository: EvotecIT/OfficeIMO
Dependency footprint
- External: None beyond
OfficeIMO.Html, which isolates AngleSharp DOM/CSS parsing. - OfficeIMO:
OfficeIMO.HtmlandOfficeIMO.Markdownown the source models, mapping, plug-in hooks, and diagnostics.
See the complete OfficeIMO package map for related formats and conversion paths.
| 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.Html (>= 3.0.3)
- OfficeIMO.Markdown (>= 3.0.3)
-
.NETStandard 2.0
- OfficeIMO.Html (>= 3.0.3)
- OfficeIMO.Markdown (>= 3.0.3)
-
net10.0
- OfficeIMO.Html (>= 3.0.3)
- OfficeIMO.Markdown (>= 3.0.3)
-
net8.0
- OfficeIMO.Html (>= 3.0.3)
- OfficeIMO.Markdown (>= 3.0.3)
NuGet packages (6)
Showing the top 5 NuGet packages that depend on OfficeIMO.Markdown.Html:
| Package | Downloads |
|---|---|
|
OfficeIMO.Word.Markdown
Markdown converter for OfficeIMO.Word - Convert Word documents to/from Markdown using OfficeIMO.Markdown |
|
|
HtmlTinkerX
HTML, CSS, and JavaScript parsing, extraction, auditing, formatting, and browser automation for .NET and PowerShell. |
|
|
OfficeIMO.MarkdownRenderer
WebView-friendly Markdown rendering helpers (shell + incremental updates) built on OfficeIMO.Markdown. |
|
|
OfficeIMO.Reader.Html
HTML and MHTML adapter for OfficeIMO.Reader using OfficeIMO.Html. |
|
|
OfficeIMO.MarkdownRenderer.IntelligenceX
IntelligenceX renderer plugin pack for OfficeIMO.MarkdownRenderer with transcript-oriented preset helpers and IX visual aliases. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.3 | 491 | 7/27/2026 |
| 3.0.2 | 1,137 | 7/26/2026 |
| 3.0.1 | 651 | 7/26/2026 |
| 3.0.0 | 733 | 7/20/2026 |
| 2.0.1 | 1,363 | 7/14/2026 |
| 2.0.0 | 787 | 7/14/2026 |
| 0.1.42 | 1,016 | 7/9/2026 |
| 0.1.41 | 871 | 7/8/2026 |
| 0.1.40 | 1,041 | 7/5/2026 |
| 0.1.39 | 827 | 7/4/2026 |
| 0.1.38 | 1,702 | 6/27/2026 |
| 0.1.37 | 784 | 6/27/2026 |
| 0.1.36 | 1,002 | 6/24/2026 |
| 0.1.35 | 791 | 6/23/2026 |
| 0.1.34 | 913 | 6/21/2026 |
| 0.1.33 | 777 | 6/16/2026 |
| 0.1.32 | 923 | 6/16/2026 |
| 0.1.31 | 743 | 6/15/2026 |
| 0.1.30 | 768 | 6/13/2026 |
| 0.1.29 | 798 | 6/12/2026 |