-
-
Notifications
You must be signed in to change notification settings - Fork 289
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
chore: fix documentation CLI #6566
chore: fix documentation CLI #6566
Conversation
.github/workflows/docs-check.yml
Outdated
@@ -38,14 +38,13 @@ jobs: | |||
- name: Check wordlist is sorted | |||
run: scripts/wordlist_sort_check.sh | |||
|
|||
- name: Spellcheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved before the CLI reference generation as otherwise spellcheck
fails on all custom headers ids.
We use custom header ids for subcommand arguments (-
instead of --
) so that previous links are not broken.
CLI docs are already checked as they are part of the source code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLI docs are already checked as they are part of the source code.
What do you mean here? I don't think we are spellchecking the source code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm that's unfortunate.
Spellchecking the CLIs docs fail because spellcheck wants to validate all ids. Not providing custom ids would potentially break external links.
Apparently there is no alternative with latest docusaurus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The solution probably is to switch to mdx
and explicitly export TOC metadata via the toc
global. See facebook/docusaurus#6201 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so before did it pass validation because we used backticks `` for those values, and can't we use this approach as well or does it not format as we want it to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately spellcheck is also applied to the custom id part, and this part can't be escaped.
e.g. ### `--myArg` {#-myArg}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have these changes deployed somewhere to review? I guess I can run the branch locally as well to review the rendered UI. This is similar to ethereum/beacon-APIs#415 would be great to have but likely a bit of effort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But since we plan to add more complex / interactive code examples in the docs, it might be warranted to implement as it makes reviewing so much easier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can see it deployed here: https://jeluard.github.io/lodestar/validator-management/validator-cli
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## unstable #6566 +/- ##
=========================================
Coverage 61.48% 61.49%
=========================================
Files 556 556
Lines 58891 58895 +4
Branches 1854 1856 +2
=========================================
+ Hits 36212 36216 +4
Misses 22638 22638
Partials 41 41 |
docs/package.json
Outdated
"@docusaurus/core": "3.1.1", | ||
"@docusaurus/preset-classic": "3.1.1", | ||
"@docusaurus/theme-mermaid": "^3.1.1", | ||
"@docusaurus/core": "0.0.0-5872", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we wanna wait until this fix is in a stable release? Deadline would be the 1.18.0 if it is not released by then we can go ahead and merge this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would lean towards merging, as it would allow to work on things like optimizing SEO in parallel.
Given that this dependency is docs
specifics, I think it's fine.
}); | ||
|
||
lightclient.emitter.on(LightclientEvent.lightClientOptimisticHeader, async (optimisticUpdate) => { | ||
logger.info(optimisticUpdate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did you find all these formatting issues, just manual review?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those were identified by yarn docs:lint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah right sorry, you already noted that in the PR description but I am a bit confused, how was this not caught by the CI
lodestar/.github/workflows/docs-check.yml
Lines 46 to 47 in 533a08e
- name: Check docs format | |
run: yarn docs:lint:fix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line actually fixes the format directly without failing, then the workflow proceeds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line actually fixes the format directly without failing, then the workflow proceeds.
this seems wrong, at least in .github/workflows/docs-check.yml
it doesn't seem right to run lint:fix, should just do lint check instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, changed so that it runs yarn docs:lint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, changed so that it runs
yarn docs:lint
Would be good to double check that it now also fails if there is a lint issue. Ideally, we should not have this change in this PR (Im ok with having it here tho)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does, I had to fix an extra lint issue :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed that URLs are broken again on this branch
https://jeluard.github.io/lodestar/validator-management/validator-cli/#-keymanager.port
vs.
https://chainsafe.github.io/lodestar/validator-management/validator-cli/#-keymanagerport
packages/cli/docsgen/markdown.ts
Outdated
@@ -90,7 +90,7 @@ function renderExamplesSection(examples: CliExample[], sectionTitle?: string, lo | |||
function renderOption(optionName: string, option: CliOptionDefinition): string | undefined { | |||
if (option.hidden) return; | |||
|
|||
const commandOption = [`<h3 id='-${optionName}'><code>--${optionName}</code><a href="#-${optionName}" class="hash-link" title="--${optionName}"></a></h3>`]; | |||
const commandOption = [`### \`--${optionName}\` {#-${optionName}}`]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cli flag headers look much bigger than what we currently have
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we add 4x # previously
lodestar/packages/cli/docsgen/markdown.ts
Line 89 in c3afb0b
const commandOption = [`#### \`--${optionName}\``]; |
Actually I realize that my solution of generating the TOC doesn't help with the spell-check issue, as there is still a need to generate the html anchor using custom-ids. So we are back to the same 2 options:
Note that there is a way to handle link redirects with My preference would be to bite the bullet and fix links at the source as much as we can and adopt the new link format. |
Some nav links from toc on the sidebar don't work Results in this URL: https://jeluard.github.io/lodestar/validator-management/validator-cli/#slashing-protection%20%3Ccommand%3E |
The majority of broken links were actually due to splitting docs up and moving into different sub paths. Since linking to specific CLI flag is quite new, the amount of broken links will be limited, and worst case the user still ends up on the right CLI docs page, just not navigated to the flag directly. Let's go ahead and use the approach that works with our new docs setup the best and without workarounds, I think I know pretty well were to fix docs, and will do that once we release the new docs |
This reverts commit 652422a.
Latest version using the out-of-the-box docusaurus solution is deployed. Sounds like a more robust approach. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I think before we do the release we should do another sweep and compare the new docs vs currently deployed docs
I deployed |
Yes looks mostly correct, I opened a PR with some minor fixes #6590. Also gave this a try locally, devex is very good now :) |
🎉 This PR is included in v1.18.0 🎉 |
Motivation
Make sure documentation CLI properly allow access to command arguments.
Note: format changes are the result of
yarn docs:lint:fix