dotnet-cstomd
2.0.1
dotnet tool install --global dotnet-cstomd --version 2.0.1
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local dotnet-cstomd --version 2.0.1
#tool dotnet:?package=dotnet-cstomd&version=2.0.1
nuke :add-package dotnet-cstomd --version 2.0.1
CsToMd
Idea and Overview
The dotnet CLI tool 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 since v1.2.0:
- Converting the section outlined with
//md{
and//md}
comments int the collapsed markdown details. - The optional
cstomd.config
file in the folder with the lines starters to be removed completely from the generated documentation file.
Dotnet CLI tool
The dotnet-cstomd is a dotnet CLI tool. It may be called from the command line and from the MSBuild scripts (enabling the document generation in the build pipeline).
I addition the dotnet tool enables the documentation development in the Visual Studio Code.
How to use
- Install the dotnet-cstomd globally from the nuget, e.g. in the shell of your choice
dotnet tool install --global dotnet-cstomd --version 2.0.1
. Now you can invokecstomd MyClass.cs
directly and get theMyClass.md
output.
Build integration
Switch to your project:
cd path\to\MyProject
Add the tool manifest file:
dotnet new tool-manifest
Install the tool:
dotnet tool install --global dotnet-cstomd --version 1.2.1
(the manifest file will be updated and later used for restore)Add the section to you project:
<ItemGroup> <DocFile Include="**\*.cs" /> </ItemGroup> <Target Name="MdGenerate" BeforeTargets="BeforeBuild"> <Exec WorkingDirectory="$(ProjectDir)" Command="dotnet cstomd %(DocFile.Identity)" /> </Target>
You may check the DryIoc documentation project file for the real-world case example.
You may run the document generation target without the rest the build:
dotnet msbuild -target:MdGenerate path\to\MyProject\MyProject.csproj
You may create a helper build_the_docs
file and store the command there.
Here is the MS tutorial for installing and using the local tools.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
This package has no dependencies.
Version | Downloads | Last updated |
---|---|---|
2.0.1 | 239 | 9/14/2024 |
1.2.1 | 1,668 | 8/31/2020 |
1.2.0 | 424 | 8/28/2020 |
1.0.0-preview-04 | 316 | 8/24/2020 |
1.0.0-preview-03 | 304 | 8/21/2020 |
1.0.0-preview-02 | 318 | 8/21/2020 |
1.0.0-preview-01 | 285 | 8/21/2020 |
## v2.0.0 - Major release
- breaking: Updated to run in .NET 6.0 instead of .NET Core 3.1
- adding: readme.md file to the package
## v1.2.1 - Bug-fix release
- added: Adding the new line after the collapsible section otherwise it breaks the markdown
## v1.2.0 - Feature release
- added: #3 Make it to dotnet CLI tool (dotnet-cstomd)
- added: #4 Ability to remove specific lines from the md output (cstomd.config)
- added: #6 Add the special comments to wrap the section into collapsible details enhancement
- added: #7 Strip the comment from the line with `//md` enhancement