Documark - Documark
A C# documentation generator that uses a combination of C# reflection and .NET's XML documentation to generate human readable documentation in markdown format.
This project spawned out of desire to have simple documentation that could be easy hosted on github. Other documentation I tried did not provide the features I wanted or felt too bulky to customize. So I decided to investigate creating my own program.
How does it work?
After looking into how to extract documentation from a .NET project, I discovered that .NET can generate XML documentation. This is the standard XML documentation Visual Studio assists you with when writing. It typically looks like the following.
/// <summary>
/// This is a summary of some method and a reference to <see cref="MyType.OtherMember">.
/// </summary>
/// <returns>
/// An arbitrary value with no meaning.
/// </returns>
/// <exception cref="System.InvalidOperationException">Thrown when the argument is invalid.</exception>
/// <param name="arg">A description of arg.</param>
A .NET project can then collect all of the XML based documentation into a single file by adding an entry to your *.csproj
file.
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Documark then reads this documentation file and with the help of .NET reflection, generates markdown documents for the assembly, types and members. Links are automatically generated between documents as well, so a type may refer to another type and you can jump between the documents.
What does it look like?
The following is an example of a member level document for Heap<T>.Contains
rendered by Github.
How can I use it?
Currently, the best option you have is to clone the project on Github.
Once cloned, navigate your terminal to Documark project folder and run the following command.
dotnet publish -c Release -r win-x64 /p:SelfContained=false /p:PublishSingleFile=true
This should generate a single executable file in the bin\Release\netcoreapp3.1\win-x64\publish
directory. Then you can use it as described in the Documark README.