MarkdownToDocxGenerator 1.2.0-preview-045
See the version list below for details.
dotnet add package MarkdownToDocxGenerator --version 1.2.0-preview-045
NuGet\Install-Package MarkdownToDocxGenerator -Version 1.2.0-preview-045
<PackageReference Include="MarkdownToDocxGenerator" Version="1.2.0-preview-045" />
<PackageVersion Include="MarkdownToDocxGenerator" Version="1.2.0-preview-045" />
<PackageReference Include="MarkdownToDocxGenerator" />
paket add MarkdownToDocxGenerator --version 1.2.0-preview-045
#r "nuget: MarkdownToDocxGenerator, 1.2.0-preview-045"
#:package MarkdownToDocxGenerator@1.2.0-preview-045
#addin nuget:?package=MarkdownToDocxGenerator&version=1.2.0-preview-045&prerelease
#tool nuget:?package=MarkdownToDocxGenerator&version=1.2.0-preview-045&prerelease
MarkdownToDocxGenerator
Transform your Markdown documentation into professional Word documents effortlessly.
Stop manual document creation. Automate your documentation workflow with .NET.
๐ What is MarkdownToDocxGenerator?
MarkdownToDocxGenerator is a powerful .NET library that converts Markdown files into professional DOCX (Word) documents. Whether you're generating technical documentation, reports, or automated documentation workflows, this library seamlessly integrates into your .NET applications with minimal configuration.
โจ Key Features
- ๐ Markdown to DOCX Conversion: Transform a folder of
.mdfiles into a single, formatted Word document - ๐จ Custom Templates: Apply your own
.dotxWord template for consistent branding and styling - ๐ Dependency Injection Ready: Easily register as singleton or transient in your DI container
- ๐ Logging Support: Integrates with
ILoggerfor comprehensive diagnostics and monitoring - ๐ง Pre/Post Processing Hooks: Customize the Word document before and after Markdown integration
- ๐ Stream Support: Generate documents in-memory for web APIs and advanced scenarios
- ๐ Cross-Platform: Works on Windows, Linux, and containers with proper configuration
๐ Getting Started
Prerequisites
- .NET Requirements: .NET Standard 2.0+, .NET 9+, .NET 10+
- Linux/Containers: Install
libgdiplusfor DOCX/image processing
Installation
Install the NuGet package via the Package Manager Console:
Install-Package MarkdownToDocxGenerator
Or using the .NET CLI:
dotnet add package MarkdownToDocxGenerator
Supported frameworks: netstandard2.0, net9.0, net10.0
Platform-Specific Configuration
Linux/Docker Containers
You must install libgdiplus for DOCX and image processing. Add this to your Dockerfile:
RUN apt-get update && apt-get install -y libgdiplus
For Alpine Linux:
RUN apk add --no-cache libgdiplus
๐ก Tip: If you encounter GDI+ or image processing errors, ensure this library is installed.
Dependencies
This library uses the following packages:
- Markdig - Fast and extensible Markdown processor
- OpenXMLSDK.Engine - Office document manipulation
- Microsoft.Extensions.DependencyInjection - DI support
- Microsoft.Extensions.Logging - Logging infrastructure
๐ป Usage
Basic Usage
1. Register the Service
In your Program.cs or Startup.cs:
services.AddMarkdownToDocxGenerator();
// Or for advanced control:
// services.RegisterMarkdownToDocxGenerator(asSingleton: true);
โ ๏ธ Important: You must register a logger (
ILogger) before callingAddMarkdownToDocxGenerator.
2. Inject and Use the Generator
public class MyService
{
private readonly MdReportGenenerator reportGenerator;
public MyService(MdReportGenenerator reportGenerator)
{
this.reportGenerator = reportGenerator;
}
public void GenerateReport()
{
var rootFolder = Path.Combine(Environment.CurrentDirectory, "MdFiles");
var templatePath = Path.Combine(Environment.CurrentDirectory, "Dotx/sample.dotx");
var outputPath = Path.Combine(Environment.CurrentDirectory, "Dotx/sample.docx");
reportGenerator.Transform(outputPath, rootFolder, templatePath);
}
}
Transform Parameters:
outputPath: Path to the output DOCX filerootFolder: Path to the folder containing Markdown filestemplatePath: (Optional) Path to a.dotxtemplate file
Advanced Usage
In-Memory Document Generation
Use TransformWithStream to generate a DOCX as a Stream (ideal for web APIs and cloud services):
var markdownContents = new List<string> { "# Title", "Some content..." };
using var templateStream = File.OpenRead("template.dotx");
using var docxStream = reportGenerator.TransformWithStream(markdownContents, templateStream);
// Save or return docxStream as needed
Pre/Post Processing Hooks
Customize the Word document before or after Markdown integration:
reportGenerator.Transform(
outputPath,
rootFolder,
templatePath,
preHook: word => { /* customize WordManager before content */ },
postHook: word => { /* finalize document */ }
);
๐ฏ What You Get
Benefits
- โฑ๏ธ Time Savings: Automate documentation generation instead of manual Word editing
- ๐ Consistency: Use templates to ensure uniform formatting across all documents
- ๐ Automation: Integrate into CI/CD pipelines for automatic documentation updates
- ๐งช Testable: Unit tests included - see the test project for real-world examples
- ๐ก๏ธ Well-Tested: Comprehensive unit tests ensure reliability and code quality
Real-World Use Cases
- Technical Documentation: Generate API documentation, user guides, and technical specifications
- Report Generation: Create automated business reports, project status updates
- Documentation Pipelines: Integrate with CI/CD to keep documentation in sync with code
- Multi-Format Publishing: Convert Markdown content to Word for further distribution
๐งช Testing & Examples
Explore the unit tests in the repository for real-world usage examples and edge cases.
๐ง Troubleshooting
| Issue | Solution |
|---|---|
| GDI+ or Image Errors (Linux/Containers) | Ensure libgdiplus is installed in your environment |
| Logging Not Working | The library uses ILogger - verify logging is configured in your application |
| Template Issues | If the template file is missing or invalid, check logs for warnings. The generator will skip invalid templates |
๐ค Contributing
We welcome contributions! Here's how you can help:
- ๐ Found a bug? Open an issue
- ๐ก Have a feature idea? Submit a feature request
- ๐ง Want to contribute code? Check out our contribution guidelines
If you find this project useful, please โญ star it on GitHub!
๐ License
This project is licensed under the terms specified in the LICENSE file.
โ Support the Author
If you find this project helpful, consider supporting the author:
| 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 was computed. 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 is compatible. 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 was computed. 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. |
-
.NETStandard 2.0
- Markdig (>= 0.42.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.0-rc.1.25451.107)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0-rc.1.25451.107)
- Microsoft.Extensions.Logging.Console (>= 10.0.0-rc.1.25451.107)
- OpenXMLSDK.Engine (>= 2022.10313.0-preview-044)
-
net10.0
- Markdig (>= 0.42.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.0-rc.1.25451.107)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0-rc.1.25451.107)
- Microsoft.Extensions.Logging.Console (>= 10.0.0-rc.1.25451.107)
- OpenXMLSDK.Engine (>= 2022.10313.0-preview-044)
-
net9.0
- Markdig (>= 0.42.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.0-rc.1.25451.107)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0-rc.1.25451.107)
- Microsoft.Extensions.Logging.Console (>= 10.0.0-rc.1.25451.107)
- OpenXMLSDK.Engine (>= 2022.10313.0-preview-044)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MarkdownToDocxGenerator:
| Package | Downloads |
|---|---|
|
MDev.Dotnet.SemanticKernel.Plugins.Oxml.Docx
Plugin for semantic kernel that let you (or the LLM) to create docx documents |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.0 | 726 | 9/12/2025 |
| 1.2.0-preview-045 | 63 | 3/26/2026 |
| 1.2.0-preview-034 | 391 | 12/11/2025 |
| 1.2.0-preview-033 | 390 | 12/11/2025 |
| 1.2.0-preview-032 | 394 | 12/11/2025 |
| 1.2.0-preview-031 | 394 | 12/11/2025 |
| 1.2.0-preview-030 | 122 | 10/24/2025 |
| 1.2.0-preview-029 | 154 | 10/23/2025 |
| 1.2.0-preview-027 | 98 | 9/12/2025 |
| 1.2.0-preview-026 | 94 | 9/12/2025 |
| 1.2.0-preview-025 | 91 | 9/12/2025 |
| 1.2.0-preview-024 | 92 | 9/12/2025 |
| 1.2.0-preview-023 | 157 | 9/11/2025 |
| 1.1.0 | 2,390 | 12/16/2024 |
| 1.1.0-preview-8 | 1,774 | 7/3/2023 |
| 1.1.0-preview-7 | 238 | 7/3/2023 |
| 1.1.0-preview-12 | 175 | 12/18/2023 |
| 1.1.0-preview-021 | 148 | 12/16/2024 |
| 1.1.0-preview-020 | 156 | 12/4/2024 |
| 1.1.0-preview-019 | 146 | 12/4/2024 |