GroupDocs.Markdown 26.3.0

Prefix Reserved
dotnet add package GroupDocs.Markdown --version 26.3.0
                    
NuGet\Install-Package GroupDocs.Markdown -Version 26.3.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GroupDocs.Markdown" Version="26.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GroupDocs.Markdown" Version="26.3.0" />
                    
Directory.Packages.props
<PackageReference Include="GroupDocs.Markdown" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GroupDocs.Markdown --version 26.3.0
                    
#r "nuget: GroupDocs.Markdown, 26.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GroupDocs.Markdown@26.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GroupDocs.Markdown&version=26.3.0
                    
Install as a Cake Addin
#tool nuget:?package=GroupDocs.Markdown&version=26.3.0
                    
Install as a Cake Tool

GroupDocs.Markdown for .NET

Convert documents to clean, structured Markdown with full control over output flavor, image handling, and formatting. Built for AI/LLM pipelines, static site generators, and document processing workflows.

Quick Start

using GroupDocs.Markdown;

// One-liner — convert any supported document to Markdown
string md = MarkdownConverter.ToMarkdown("report.docx");

// Save directly to file
MarkdownConverter.ToFile("report.docx", "report.md");

Features

  • 20+ input formats — PDF, Word, Excel, EPUB, MOBI, TXT, CHM, and more
  • Markdown flavor control — GitHub Flavored Markdown or strict CommonMark
  • Flexible image handling — Base64 embed, save to disk, skip, rename, or replace
  • Spreadsheet table control — Column/row truncation with ellipsis indicators
  • YAML front matter — Auto-extract document metadata for Jekyll, Hugo, Docusaurus
  • Heading level offset — Shift heading levels when embedding in larger documents
  • Document inspection — Read page count, title, author without converting
  • Async API — Truly async file I/O for web apps and serverless
  • Custom DOM renderer — Full control over every aspect of the Markdown output
  • Cross-platform — Windows, Linux, macOS

Examples

Convert PDF to Markdown

using GroupDocs.Markdown;

License.Set("GroupDocs.Markdown.lic");

string md = MarkdownConverter.ToMarkdown("business-plan.pdf");
File.WriteAllText("business-plan.md", md);

Password-Protected Documents

var loadOptions = new LoadOptions(FileFormat.Docx) { Password = "secret" };
string md = MarkdownConverter.ToMarkdown("confidential.docx", loadOptions);

Save Images to a Folder with Relative Paths

var options = new ConvertOptions
{
    ImageExportStrategy = new ExportImagesToFileSystemStrategy("output/images")
    {
        ImagesRelativePath = "images"  // Markdown references: ![alternate text is missing from this package README image](images/img-001.png)
    }
};
MarkdownConverter.ToFile("annual-report.docx", "output/report.md", options);

GitHub Flavored Markdown vs CommonMark

// GFM (default) — pipe tables, strikethrough
var gfm = new ConvertOptions { Flavor = MarkdownFlavor.GitHub };
string md = MarkdownConverter.ToMarkdown("data.xlsx", gfm);
// | Column A | Column B |
// | --- | --- |
// | value1 | value2 |

// CommonMark — tables rendered as code blocks
var cm = new ConvertOptions { Flavor = MarkdownFlavor.CommonMark };

YAML Front Matter for Static Site Generators

var options = new ConvertOptions { IncludeFrontMatter = true };
string md = MarkdownConverter.ToMarkdown("article.docx", options);
// ---
// title: "Q3 Report"
// author: "Jane Doe"
// format: Docx
// pages: 12
// ---
//
// # Q3 Report
// ...

Heading Level Offset

Shift all headings when embedding converted content inside a larger document:

var options = new ConvertOptions { HeadingLevelOffset = 2 };
string md = MarkdownConverter.ToMarkdown("chapter.docx", options);
// Source: # Title     → Output: ### Title
// Source: ## Section  → Output: #### Section

Spreadsheet Options

Control how Excel/CSV tables are rendered:

var options = new ConvertOptions
{
    MaxColumns = 8,              // Truncate wide tables
    MaxRows = 50,                // Limit rows per worksheet
    SheetSeparator = "\n---\n",  // Separator between sheets
    IncludeHiddenSheets = false  // Skip hidden worksheets
};
MarkdownConverter.ToFile("data.xlsx", "data.md", options);

Convert Specific Pages Only

var options = new ConvertOptions { PageNumbers = new[] { 1, 3, 5 } };
MarkdownConverter.ToFile("manual.pdf", "selected-pages.md", options);

Inspect Document Without Converting

DocumentInfo info = MarkdownConverter.GetInfo("report.docx");
Console.WriteLine($"Format: {info.FileFormat}");      // Docx
Console.WriteLine($"Pages: {info.PageCount}");         // 42
Console.WriteLine($"Title: {info.Title}");             // "Q3 Report"
Console.WriteLine($"Author: {info.Author}");           // "Jane Doe"
Console.WriteLine($"Encrypted: {info.IsEncrypted}");   // false

Custom Image Handling — Rename or Replace

public class WatermarkHandler : IImageSavingHandler
{
    public void Handle(CustomImageSavingArgs args)
    {
        // Replace every image with a watermark
        args.SetReplacementImage(File.OpenRead("watermark.png"));
    }
}

var options = new ConvertOptions
{
    ImageExportStrategy = new CustomImagesStrategy("images", new WatermarkHandler())
    {
        ImagesRelativePath = "images"
    }
};
MarkdownConverter.ToFile("confidential.docx", "redacted.md", options);

Async API

string md = await MarkdownConverter.ToMarkdownAsync("report.docx");
await MarkdownConverter.ToFileAsync("report.docx", "output.md");
DocumentInfo info = await MarkdownConverter.GetInfoAsync("report.docx");

Instance API with Full Control

using var converter = new MarkdownConverter("report.docx");

// Inspect first
DocumentInfo info = converter.GetDocumentInfo();
Console.WriteLine($"{info.PageCount} pages by {info.Author}");

// Then convert
ConvertResult result = converter.Convert(new ConvertOptions
{
    IncludeFrontMatter = true,
    HeadingLevelOffset = 1
});

Console.WriteLine(result.Content);

// Check for non-fatal warnings
foreach (string warning in result.Warnings)
    Console.WriteLine($"Warning: {warning}");

Error Handling

All methods throw on failure — standard .NET try/catch:

try
{
    string md = MarkdownConverter.ToMarkdown("file.docx");
}
catch (DocumentProtectedException)
{
    Console.WriteLine("Wrong or missing password.");
}
catch (InvalidFormatException)
{
    Console.WriteLine("File is corrupt or unsupported.");
}

Discover Supported Formats at Runtime

IReadOnlyList<FileFormat> formats = MarkdownConverter.GetSupportedFormats();
foreach (FileFormat format in formats)
    Console.WriteLine(format);  // Doc, Docx, Xlsx, Pdf, Epub, ...

Supported Input Formats

Category Formats
Word Processing DOCX, DOC, DOCM, DOT, DOTX, DOTM, RTF, ODT, OTT
Spreadsheet XLSX, XLS, XLSB, XLSM, CSV, TSV, ODS, OTS
PDF PDF
Ebook EPUB, MOBI
Text TXT
Help CHM

Requirements

  • .NET Framework 4.6.2+ or .NET 6.0+ / .NET 8.0+ / .NET 10.0+
  • Windows, Linux, or macOS

License

See https://about.groupdocs.com/legal/ for terms of use, copyright, EULA, and privacy policy.

Support

Free Support Forum | Paid Support Helpdesk

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
26.3.0 33 4/2/2026
26.1.0 119 1/16/2026
25.9.0 232 9/9/2025