Home

Awesome

CsToMd

NuGet Badge

Overview

The dotnet CLI tool and Visual Studio extension to generate the Markdown documentation file from the C# file.

The idea is to have a normal C# .cs file with the special comments /*md, md*/, and //md which will be stripped when converting the file into the respective Markdown .md file. There are couple of additional features but this is basically it.

Now you have the documentation always up-to-date with the runnable samples in the normal .NET Test library project with NUnit, XUnit, etc.

You may check the DryIoc documentation project for the real-world case example.

The additional features in v1.2.0:

Visual Studio extension

This extension for Visual Studio 2019+ contains the CustomTool File Generator.

When applied to the C# source file it looks like this:

VS file properties

The generated result:

VS result

How to use

Dotnet CLI tool

The dotnet-cstomd is a dotnet CLI tool providing the same functionality as a Visual Studio extension plus it may be called from the command line and from the MSBuild enabling the document generation in the build pipeline.

In addition the dotnet tool enables the documentation development in the Visual Studio Code.

VSCode usage

Ad-hoc document generation

Build integration

 dotnet msbuild -target:MdGenerate path\to\MyProject\MyProject.csproj

You may create a helper shell script with the command above.

Here is the MS tutorial for installing and using the local tools.