SharpLibMarkdownDocGenerator 1.0.2

dotnet add package SharpLibMarkdownDocGenerator --version 1.0.2                
NuGet\Install-Package SharpLibMarkdownDocGenerator -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SharpLibMarkdownDocGenerator" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SharpLibMarkdownDocGenerator --version 1.0.2                
#r "nuget: SharpLibMarkdownDocGenerator, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SharpLibMarkdownDocGenerator as a Cake Addin
#addin nuget:?package=SharpLibMarkdownDocGenerator&version=1.0.2

// Install SharpLibMarkdownDocGenerator as a Cake Tool
#tool nuget:?package=SharpLibMarkdownDocGenerator&version=1.0.2                

sharp-lib-markdown-doc-generator

.net类库api文档(markdown)生成器

截图

<img style="background:#bbb;padding:.5rem;" src="./assets/1.gif"></img>

⚠️ 注意事项

  • 不支持.netframework 类库
  • 不应该在输出目录中做文件改动
  • 提前构建项目生成 dll 和 xml 文件(需要在项目文件中添加配置<GenerateDocumentationFile>True</GenerateDocumentationFile>)

使用

  1. 新建控制台应用程序(.Net6.0+),并引用SharpLibMarkdownDocGeneratornuget 包

  2. 添加如下代码

using SharpLibMarkdownDocGenerator;

public static void Main(string[] args)
{
    var dllPath = @"your/path/your.dll";
    var outputDirectory = @"/output";
    var request = new GenerateRequest(dllPath, outputDirectory);
    Generator.Generate(request);
}

GenerateRequest 参数说明

1. DllPath

dll 文件路径,在该目录中同时应该包含 deps.json 和 xml 文件

2. OutputPath

文档输出的位置,不应该在生成的目录中做文件修改,因为可能生成多次,有被覆盖的可能

3. AddtionalMarkdownDirecotry

额外需要补充的文档目录 使用方式

  • 先运行一次文档生成,假设结果产生了a.md,b.md,c.md
  • 现在我们想对a.md进行一个示例的补充
  • 在 AddtionalMarkdownDirecotry 中新建文件a.md,并添加内容
  • 再次运行文档生成,这时产生的a.md中会将 AddtionalMarkdownDirecotry 文件夹中a.md内容嵌入到最后
4.ExternalUrlResolver

外部地址处理器 如public ThirdPartyType GetData()这样的函数中ThirdPartyType是第三方库中的类型

var request = new GenerateRequest(dllPath, outputDirectory);
request.ExternalUrlResolver = (type)=>
{
    if (type.Name.Equals("ThirdPartyType")) return "https://www.thirdparty.com/doc/ThirdPartyType.md";
    return GenerateRequest.ResolveMicrosoftDoc(type);//微软官方文档
};
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 100 9/14/2024
1.0.2-alpha 81 9/14/2024
1.0.1 135 8/13/2024