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

[gen-apidocs] remove standalone navdata, use DOM instead #334

Merged
merged 1 commit into from
Sep 17, 2023

Conversation

xrstf
Copy link
Contributor

@xrstf xrstf commented Sep 16, 2023

This is a follow-up to #333. In that PR, the navData.js generation was refactored, but I was unsure if it still functioned properly. While investigating I found that there is really no need to keep generating a standalone file, if we simply put the necessary data into the DOM from the beginning.

So that's what this PR does. It extends the generated markup a bit, by introducing <div class="toc-item" id="...">...</div> wrappers around each concept/section and by re-organizing the DOM for the navigation tree entirely. That way the scroll-apiref.js can deduce everything it needs from the site already.

Sadly the script lives in another castle, so to show the result of this PR, I uploaded it to https://kube-api.ninja/refdocs-pr/ (using copies of the assets hosted on kubernetes.io).

kubernetes/website#43076 is the sister PR to this one, containing the rewritten scroll-apiref.js.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 16, 2023
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 16, 2023
fmt.Fprintf(html, "<LINK rel=\"stylesheet\" href=\"/css/style_apiref.css\" type=\"text/css\">\n")
fmt.Fprintf(html, "<LINK rel=\"stylesheet\" href=\"css/bootstrap-4.3.1.min.css\" type=\"text/css\">\n")
fmt.Fprintf(html, "<LINK rel=\"stylesheet\" href=\"css/fontawesome-4.7.0.min.css\" type=\"text/css\">\n")
fmt.Fprintf(html, "<LINK rel=\"stylesheet\" href=\"css/style_apiref.css\" type=\"text/css\">\n")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These links are to ensure that the stylesheets can be found at k8s.io/docs website.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I had to modify them to make it easier to host the temporary files on my server. Before merging this, I will revert them :)

On that note, (how) do we need to coordinate between this repo and the website repo? Both PRs would need to be merged at roughly the same time, and then new API docs would need to be generated and copied over. What's the best way to do this cleanly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We fix the generator first, then we regenerate the reference and copy them over.

@tengqm
Copy link
Contributor

tengqm commented Sep 16, 2023

@xrstf Thanks for this cleanup. Let me know when it is ready to be merged.
I've just checked the live result and it looked pretty good to me.

@xrstf
Copy link
Contributor Author

xrstf commented Sep 17, 2023

/hold

This is ready from my site, but I'm putting it on hold to coordinate the merge and deployment.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 17, 2023
@xrstf xrstf changed the title WIP - [gen-apidocs] remove standalone navdata, use DOM instead [gen-apidocs] remove standalone navdata, use DOM instead Sep 17, 2023
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 17, 2023
@tengqm
Copy link
Contributor

tengqm commented Sep 17, 2023

/lgtm
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 17, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 17, 2023
@tengqm
Copy link
Contributor

tengqm commented Sep 17, 2023

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tengqm, xrstf

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 17, 2023
@k8s-ci-robot k8s-ci-robot merged commit 20b4c5f into kubernetes-sigs:master Sep 17, 2023
1 of 2 checks passed
@xrstf xrstf deleted the improve-markup branch September 17, 2023 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants