Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"View Source" is not working/showing up in API docs #8112

Closed
tig opened this issue Jul 27, 2022 · 5 comments
Closed

"View Source" is not working/showing up in API docs #8112

tig opened this issue Jul 27, 2022 · 5 comments
Labels
dotnet Generate .NET API reference docs git Integrate with source control systems like GitHub, Azure DevOps, GitLab, etc.

Comments

@tig
Copy link

tig commented Jul 27, 2022

Operating System: Windows

DocFX Version Used: 2.59.3.0

Template used: (default or statictoc or contain custom template)

slight tweak to default

Steps to Reproduce:

See https://github.com/gui-cs/Terminal.Gui

  1. Build docs (https://github.com/gui-cs/Terminal.Gui/tree/develop/docfx/build.ps1)
  2. View localhost:8080

Expected Behavior:

Expect to see "View Source" somewhere in the API docs.

Actual Behavior:
image

I'm sure I'm doing something wrong, but can't see what it is. I've read the docfx documentation, and all it says is that I need to have my branch specified in the environment variable. Even with that none of the generated HTML has "Viewsource" or "View Source" anywhere in it...

@paulushub
Copy link

paulushub commented Jul 27, 2022

@tig It seems _gitContribute is missing in your docfx.jon. Something like

"_gitContribute": {
"repo": "https://github.com/gui-cs/Terminal.Gui",
"branch": "develop",
"apiSpecFolder": "apidoc"
}

You may also like "_gitUrlPattern": "github"

Also, with "_disableContribution": true in your docfx.json, the buttons may not show.

@tig
Copy link
Author

tig commented Jul 28, 2022

Thanks. I tried your suggestions and it's still not working.

Here's my latest docfx.json:

{
  "metadata": [
    {
      "src": [
        {
          "files": [
            "Terminal.Gui.dll"
          ],
          "exclude": [
            "**/obj/**",
            "_site/**"
          ],
          "src": "../Terminal.Gui/bin/Release/net6.0"
        }
      ],
      "dest": "api/Terminal.Gui",
      "shouldSkipMarkup": true,
      "properties": {
          "TargetFramework": "net6.0"
      }
    },
    {
      "src": [
        {
          "files": [
            "UICatalog.dll"
          ],
          "exclude": [
            "**/obj/**",
            "_site/**"
          ],
          "src": "../UICatalog/bin/Release/net6.0"
        }
      ],
      "dest": "api/UICatalog",
      "shouldSkipMarkup": false,
      "properties": {
          "TargetFramework": "net6.0"
      }
    }
  ],
  "build": {
    "template": [
      "default",
      "./templates/default"
    ],
    "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": "../docs",
    "globalMetadata": {
      "_enableSearch": "true",
      "_appLogoPath": "images/logo48.png",
      "_disableContribution": false,
      "_gitContribute": {
        "repo": "https://github.com/gui-cs/Terminal.Gui",
        "branch": "develop",
        "apiSpecFolder": "apidoc"
      },
      "_gitUrlPattern": "github"
    },
    "globalMetadataFiles": [],
    "fileMetadataFiles": [],
    "postProcessors": ["ExtractSearchIndex"],
    "noLangKeyword": false,
    "keepFileLink": false
  }
}

Still no View Source or Contribute links:

image

@paulushub
Copy link

@tig You are possibly out of luck. It seems it does not work with metadata compiled from DLL. On my PC, where I have not experienced the reported Roslyn issue, changing to project file works:

Terminal Gui

@tig
Copy link
Author

tig commented Jul 28, 2022 via email

@yufeih yufeih added dotnet Generate .NET API reference docs git Integrate with source control systems like GitHub, Azure DevOps, GitLab, etc. labels Dec 15, 2022
@filzrev
Copy link
Contributor

filzrev commented Mar 18, 2024

It seems this issue can be closed.
Because it works as expected when using project-file-based metadata generation.
And latest version of Terminal.Gui build document by using projects.

For DLL-file-based metadata generation.
View Source link is enabled when using SourceLink and PDB files are available. (Added by #8548)

@tig tig closed this as completed Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dotnet Generate .NET API reference docs git Integrate with source control systems like GitHub, Azure DevOps, GitLab, etc.
Projects
None yet
Development

No branches or pull requests

4 participants