MkDocsSharp.MDGen
2.1.0
dotnet add package MkDocsSharp.MDGen --version 2.1.0
NuGet\Install-Package MkDocsSharp.MDGen -Version 2.1.0
<PackageReference Include="MkDocsSharp.MDGen" Version="2.1.0" />
<PackageVersion Include="MkDocsSharp.MDGen" Version="2.1.0" />
<PackageReference Include="MkDocsSharp.MDGen" />
paket add MkDocsSharp.MDGen --version 2.1.0
#r "nuget: MkDocsSharp.MDGen, 2.1.0"
#:package MkDocsSharp.MDGen@2.1.0
#addin nuget:?package=MkDocsSharp.MDGen&version=2.1.0
#tool nuget:?package=MkDocsSharp.MDGen&version=2.1.0
MkDocsSharp.MDGen
Automatically generate MkDocs-friendly Markdown from your C# XML documentation comments. Runs as an MSBuild task during your build process.
Installation
dotnet add package MkDocsSharp.MDGen
Quick Start
- Enable XML documentation in your project:
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
- Build your project. The package automatically generates
docs/index.mdfrom your XML docs.
That's it! Your XML documentation comments are now converted to Markdown on every build, ready for MkDocs.
Features
- Converts all standard XML documentation tags (
<summary>,<param>,<returns>,<example>, etc.) - Outputs directly to
docs/for seamless MkDocs integration - Merges generated docs with existing Markdown files in
docs/ - Supports cross-references with
<see cref="..."/>converted to Markdown links - Handles generic types, interfaces, enums, records, and structs
- Runs automatically as part of your build process
Configuration
The default behavior works for most projects. The generated output goes to docs/index.md, and any existing .md files in docs/ are merged into the output.
To customize, you can override the MSBuild target in your .csproj:
<Target Name="AfterBuild" DependsOnTargets="GenerateMarkdownDocs">
<GenerateMarkdown
InputXml="$(OutputPath)$(AssemblyName).xml"
DocumentationPath="$(MSBuildProjectDirectory)\Docs"
MergeFiles="true"
OutputFile="$(MSBuildProjectDirectory)\API.md"
WarnOnUnexpectedTag="true"
/>
</Target>
| Property | Default | Description |
|---|---|---|
InputXml |
$(OutputPath)$(AssemblyName).xml |
XML documentation file(s) to process |
DocumentationPath |
docs |
Folder containing existing Markdown to merge |
MergeFiles |
true |
Whether to merge with existing docs |
OutputFile |
docs/index.md |
Output Markdown file path |
WarnOnUnexpectedTag |
false |
Warn on unrecognized XML tags |
CLI Usage
The package also includes a standalone command-line tool:
MkDocsSharp.MDGen -i MyAssembly.xml -o API.md
| Option | Description |
|---|---|
-i, --inputfile |
Input XML file |
-o, --outputfile |
Output Markdown file |
--cin |
Read from stdin |
--cout |
Write to stdout |
Requirements
- .NET 8.0 or later
- XML documentation enabled in your project
Contributing
See CONTRIBUTING.md for development setup and release process.
License
MIT - see LICENSE for details.
Originally forked from lontivero's gist.
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.