A MSBuild task to convert XML documentation to Markdown syntax. Support both .Net Framework and .Net Core projects.
<code lang="csharp">
tag.System
types to official MSDN pages.If you are using Visual Studio:
If you are using Rider:
<GenerateDocumentationFile>true</GenerateDocumentationFile>
to the PropertyGroup
section.<DocumentationMarkdown>$(MSBuildProjectDirectory)\Readme.md</DocumentationMarkdown>
to the PropertyGroup
section.If you are using .Net Core CLI:
DocumentationFile
property in PropertyGroup
section. The path is relative to the project directory. MSBuild Reserved and Well-Known properties are also available for this property.dotnet add package Vsxmd
to install the the package to the project.dotnet build
to build the project and generate the XML documentation and Markdown files.There are some properties to customize the Markdown file generation process. They are all optional. If you want to use them, declare them in CSPROJ file's PropertyGroup
section.
DocumentationMarkdown
It is used to specify the generated Markdown file path. It defaults to the XML documentation file name with .md
extension, under the same folder as the XML file. Similar to DocumentationFile
property, the path is relative to the project directory and MSBuild properties are available.
<PropertyGroup>
<DocumentationMarkdown>$(MSBuildProjectDirectory)\API.md</DocumentationMarkdown>
</PropertyGroup>
VsxmdAutoDeleteXml
A boolean flag to delete the XML documentation file after the Markdown file is generated.
<PropertyGroup>
<VsxmdAutoDeleteXml>True</VsxmdAutoDeleteXml>
</PropertyGroup>
There are some extended features based on XML documentation. They are not described in XML recommended tags, but they are worth to use.
To highlight code block in the Markdown file, declare the attribute lang
in <code>
tag and set it to a program language identifier.
<code lang="javascript">
function test() {
console.log("notice the blank line before this function?");
}
</code>
This library provides the following programmatic API to convert XML documentation file to Markdown syntax programmatically.
The best demo is this project's documentation file, Vsxmd.md. It is generated by this project itself.
The syntax for the list
comment tag is not well defined. It will be skipped during render. If you have ideas, please open an issue.
This project is initially inspired from a gist. But in the later releases, the implementation is rewritten.
MIT License.