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

Migrate docs site to docfx #322

Merged
merged 44 commits into from
Mar 2, 2023
Merged

Conversation

nzdev
Copy link
Contributor

@nzdev nzdev commented Dec 12, 2022

What?

Basic migration of the existing docs site to docfx.

Why?

Improved docs experience.

  • Easier to read
  • Easier to contribute.
  • Improved navigation within a page
  • Autogenerate API docs
  • Content/API Search
  • Use .NET for docs, simpler to run locally for .NET developers

How?

Created new docfx project in docs folder.
Set up docfx theme.
Migrated existing docs to docfx syntax in the /articles dir.
Configured docfx for search, improve this doc.
Configured docfx for API Docs generation.

Missing features?

  • Correctly sized Examine logo.
  • Social links at the bottom of the page as I'm unsure how to add @Shazwazza
  • Version Tabs (Converted to subheadings), V1/V2 documentation split from V3
  • 404 page
  • Redirects for existing docs links

How to test?

Install docfx
cd to /docs
In a command prompt run

docfx --serve

How to build?

Example for Azure DevOps

- task: DotNetCoreCLI@2
  displayName: Build Examine
  inputs:
    command: 'build'
    arguments: '--configuration $(BuildConfiguration)'
    projects: '**/*.csproj'

- powershell: |
    choco install docfx -y
    docfx doc/docfx.json
    if ($lastexitcode -ne 0){
      throw ("Error generating document")
    }
  displayName: "Build Documentation"

Example of docfx on github pages https://github.com/dotMorten/NmeaParser/blob/main/.github/workflows/ghpages.yml

Homepage
image

API Doc
image

Search
image

V3 Article
image

V1 / V2 Article
image

https://nzdev.github.io/Examine/index.html

@nzdev nzdev mentioned this pull request Dec 12, 2022
@nikcio
Copy link
Contributor

nikcio commented Dec 12, 2022

@nzdev For navbar & favicon I found:

"_appLogoPath": "navlogo.svg",
"_appFaviconPath": "favicon.ico"

That can be used to configure it. But docfx is missing a bunch of SoMe meta tags that the existing doc site has. Furthermore the styling in the theme as is properly needs to be looked at for this to work properly. Looking very shortly at this PR I found the following:

  • Navbar icon isn't sized after the navbar height. This means that if you add an image that is not the correct size it will overflow or align incorrectly.
  • If the Navbar image is an svg as the default logo the hover effect will make it all white.

And as a last note the test projects should properly be excluded from the API documentation. 😅

@nzdev
Copy link
Contributor Author

nzdev commented Dec 12, 2022

Thanks @nikcio Worked around the logo and filtered the API docs.

@nzdev
Copy link
Contributor Author

nzdev commented Dec 12, 2022

May be cleaner to just have v3 in docfx and have the v1/v2 on a prefix.

@nzdev
Copy link
Contributor Author

nzdev commented Dec 12, 2022

I've split out the v1 / v2 docs into their own section so that any api usages can be linked to the api docs.

@nzdev
Copy link
Contributor Author

nzdev commented Dec 13, 2022

Linked up a number of code references to the API docs.

@nzdev nzdev changed the title [Draft] Migrate docs site to docfx Migrate docs site to docfx Dec 13, 2022
@nzdev
Copy link
Contributor Author

nzdev commented Feb 6, 2023

I haven't tried this out and maybe there are other ones but would be good to get a GitHub actoin in place to publish these so we can see the live version. https://github.com/marketplace/actions/docfx-action

I've given this a go. But I'm very stuck.

@nzdev
Copy link
Contributor Author

nzdev commented Feb 10, 2023

.github/workflows/docfx-gh-pages.yml Show resolved Hide resolved
.github/workflows/docfx-gh-pages.yml Show resolved Hide resolved
docs/v2/docfx.json Show resolved Hide resolved
@Shazwazza Shazwazza merged commit f1ca99f into Shazwazza:release/3.0 Mar 2, 2023
@Shazwazza
Copy link
Owner

@nzdev was trying to build these locally, I've done:

Install docfx
cd to /docs/v2
In a command prompt run

docfx --serve

It builds the docs and serves them but it doesn't build the API docs and shows a ton of errors/warnings. Should this 'just work' or am I missing some conifguration?

Also, I found this page about publishing to GitHub pages: https://dotnet.github.io/docfx/#publish-to-github-pages I wonder if that would make things a little more flexible?

@nzdev
Copy link
Contributor Author

nzdev commented Mar 4, 2023

I think it depends on the version of docfx and what msbuild is being used. Needs to use a visual studio msbuild.

@Shazwazza
Copy link
Owner

Pretty sure it's this issue that I'm seeing dotnet/docfx#8465

@nzdev
Copy link
Contributor Author

nzdev commented Mar 5, 2023

I'd say so @Shazwazza . We had this as well on an earlier version. See https://dotnet.github.io/docfx/docs/dotnet-api-docs.html?q=msbuild#generate-from-projects-or-solutions as one possible workaround

@nzdev
Copy link
Contributor Author

nzdev commented Mar 5, 2023

See also dotnet/docfx#8136 (comment). Which version of docfx are you using? I use 2.59.4.0 without issue with VS2022 and VS2019 Build Tools installed.

@Shazwazza
Copy link
Owner

Just updated to latest docfx from '2.62.1' to version '2.62.2'. So it must have been a bug they fixed. Builds great locally now.

Now to figure out the rest :)

@Shazwazza
Copy link
Owner

Well I got it 'working' to deploy docfx to v2 sub folder but GitHub pages normal jekyll builds and our custom build aren't compatible with each other because they overwrite each other (more or less).

I'll work on updating the new docs theme, colors, etc... and just make that the main docs :)

@Shazwazza
Copy link
Owner

Alternatively i can manually build the original jekyll docs with this https://github.com/actions/jekyll-build-pages/blob/main/action.yml but seems like too much effort for an interim thing.

@Shazwazza
Copy link
Owner

@nzdev this is live now :) https://shazwazza.github.io/Examine/

Thanks so much this is fantastic :)

The branch for these docs currently are in the feature/docfx branch in the Examine repo.

@nzdev
Copy link
Contributor Author

nzdev commented Mar 8, 2023

Awesome @Shazwazza . I like the header theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants