XmlDocMarkdown generates Markdown from .NET XML documentation comments.
It is distributed as a class library, .NET tool, .NET Framework console app, and Cake addin.
The goal of this tool is to generate Markdown documentation for .NET class libraries that are simple enough to be read and understood in raw form, as rendered in GitHub, or when used to generate web pages using Jekyll and GitHub Pages. To that end, it generates standard GitHub Flavored Markdown without relying on raw HTML tags.
The most reliable way to use XmlDocMarkdown is to build and run a command-line tool that references the XmlDocMarkdown.Core class library and the assembly that you want to document. This ensures that the assembly and all of its dependencies are loaded properly.
This is easier than it sounds, because the class library contains the full implementation of the command-line application via XmlDocMarkdownApp.Run. For example, here is how the
ArgsReading library defines its documentation generation tool:
Depending on the type of console application that you build, you can run
XmlDocGen.exe directly or run
If your dependencies are simple enough, you can use the standard .NET tool (
xmldocmd), console app (
XmlDocMarkdown), or Cake addin (
Cake.XmlDocMarkdown), all documented below.
The command-line tool accepts the name or path of the input assembly, the path of the output directory, and a number of options. (Use the name of the input assembly if you have built your own command-line tool, as recommended above.)
The XML documentation file should be in the same directory as the input assembly.
The output directory will be created if necessary.
xmldocmd MyLibrary.dll docs generates Markdown documentation in the
docs directory for the
MyLibrary.dll assembly. The compiler-generated
MyLibrary.xml file should be in the same directory as
--source <url>: The URL (absolute or relative) of the folder containing the source code of the assembly, e.g. at GitHub. Required to generate source code links in the See Also sections for types. This assumes that each type is defined in a
.csfile that matches its name.
--namespace <ns>: The root namespace of the input assembly. Used to generate source code links in the See Also sections for types. If omitted, the tool guesses the root namespace from the exported types.
--visibility (public|protected|internal|private): The minimum visibility for documented types and members. If
public, only public types and members are documented. If
protected, only public and protected types and members are documented. Similarly for
private. Defaults to
--obsolete: Generates documentation for obsolete types and members, which are not documented by default.
--external <ns>: Generates links to external documentation for the specified namespace, which must be documented in the same repository with similar options.
--clean: Delete previously generated files that are no longer used.
--verify: Executes the tool without making changes to the file system, but exits with error code 1 if changes would be made. Typically used in build scripts to ensure that any changes have been reflected in the generated code.
--dryrun: Executes the tool without making changes to the file system.
--quiet: Suppresses normal console output.
--newline (auto|lf|crlf): Indicates the newline used in the output. Defaults to
auto, which uses CRLF or LF, depending on the platform.
To implement a command-line tool, call XmlDocMarkdownApp.Run with the command-line arguments.
dotnet tool install xmldocmd -g
nuget install XmlDocMarkdown -excludeversion will download the latest version of
On Mac or Linux, use Mono to run
nuget as well as the command-line tool itself.
The command-line arguments and options are the same as