kubernetes-sigs / reference-docs

Tools to build reference documentation for Kubernetes APIs and CLIs.
Apache License 2.0
87 stars 102 forks source link

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

Closed xrstf closed 10 months ago

xrstf commented 10 months ago

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).

https://github.com/kubernetes/website/pull/43076 is the sister PR to this one, containing the rewritten scroll-apiref.js.

tengqm commented 10 months ago

@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 commented 10 months ago

/hold

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

tengqm commented 10 months ago

/lgtm /hold cancel

tengqm commented 10 months ago

/approve

k8s-ci-robot commented 10 months ago

[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: - ~~[OWNERS](https://github.com/kubernetes-sigs/reference-docs/blob/master/OWNERS)~~ [tengqm] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment