我在 DocFX 配置中缺少一些东西 - 所以它不会生成正确的文档。
我有以下文件夹结构:
+Documentation
|- _site
|- api
|- apidoc
|- articles
|- images
|- src <-- This folder is autogenerated by `docfx init` command as a folders above
docfx.json
index.md
toc.md
+packages
|- Microsoft.NETCore.Platforms.1.0.1
|- ... other nuget folders
+src
|- MyRealProject
|- assets
|- bin
|- Commands
|- obj
|- Properties
|- vendor <- This folder should be excluded for documentation
app.config
MyRealProject.csproj
MyRealProject.csproj.user
Program.cs
+test
|-MyRealProjext.XUnit
|- bin
|- obj
|- Properties
app.config
.gitattributes
.gitignore
.gitmodule
MyRealProject.sln
我的docfx.json:
{
"metadata": [
{
"src": [
{
"files": [
"**/*.csproj"
],
"exclude": [
"**/obj/**",
"**/bin/**",
"_site/**",
"vendor/**"
],
"src": "../src"
}
],
"dest": "api"
}
],
"build": {
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
},
{
"files": [
"articles/**.md",
"articles/**/toc.yml",
"toc.yml",
"*.md"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"resource": [
{
"files": [
"images/**"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"overwrite": [
{
"files": [
"apidoc/**.md"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"dest": "_site",
"globalMetadataFiles": [],
"fileMetadataFiles": [],
"template": [
"default"
],
"postProcessors": [],
"noLangKeyword": false
}
}
运行该命令会docfx build
生成没有错误的文档,但是在导航到http://locahost:8080
打开目录列表而不是index.html
from_site
文件夹时。我的意思是我看到一个只有文件夹列表的网页:api/apidoc/articles/images/_site/ 等。即使我进入_site
文件夹并点击index.html
- 它确实打开了docfx生成的页面,但点击了'Api文档' 顶部显示文本:TODO: Add .NET projects to the src folder and run docfx to generate REAL API Documentation!
- 我应该在 docfx.json 中重新配置什么,以便正确读取 /src 文件夹而不是 /Documentation/src 文件夹?
- 这是
vendor/
从文件夹中排除文件夹的正确方法src/
吗?