【问题标题】:DocFX relative path to 'src' folderDocFX 到“src”文件夹的相对路径
【发布时间】:2017-04-24 13:18:27
【问题描述】:

我在 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 打开目录列表而不是_site 文件夹中的index.html 时。我的意思是我看到一个只有文件夹列表的网页: 接口/ apidoc/ 文章/ 图片/ _地点/ ETC.. 即使我进入_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 文件夹?
  • 这是从src/ 文件夹中排除vendor/ 文件夹的正确方法吗?

【问题讨论】:

    标签: documentation-generation docfx


    【解决方案1】:

    我的错。一切正常。

    我使用的是从Github 下载的代码并在本地编译。问题不在配置文件中(按预期工作),而是在模板生成中。出于某种原因,来自Github 的代码甚至没有“默认”模板。因此,即使在我执行了第一步之后:docfx.exe metadata -> 已生成元数据但它从未转换为上下文表 (TOC),因为缺少模板引擎。所以运行docfx.exe build + serve 显示空站点。 “默认”模板有一个单独的 Github 页面

    【讨论】:

    • 这有什么用?没有挑选文件,没有办法独立下载。
    猜你喜欢
    • 1970-01-01
    • 2015-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多