-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
docs: fix janky rendering of toc on docs.docker.com #5653
docs: fix janky rendering of toc on docs.docker.com #5653
Conversation
Signed-off-by: David Karlsson <[email protected]>
cc @corhere |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5653 +/- ##
=======================================
Coverage 59.49% 59.49%
=======================================
Files 346 346
Lines 29371 29371
=======================================
Hits 17474 17474
Misses 10922 10922
Partials 975 975 |
#### <a name="log-format"></a> Daemon logging format | ||
#### Daemon logging format {#log-format} |
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 think we use this approach for all of the CLI reference docs (and use that format to match sections with the options table); is it an issue for those as well?
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.
No, there it works because they use a different templating logic.
The default toc rendering uses a recursive template on Hugo's heading fragments, which are parsed out of the markdown file: https://github.com/docker/docs/blob/main/layouts/partials/pagemeta.html
The CLI reference docs are rendered from yaml files, so we can't use the same API. Instead, we construct the toc manually using a page store, and render that: https://github.com/docker/docs/blob/380ca6cc9de0143e462cd36c14f91319de22aece/layouts/_default/cli.html#L197-L224
Funny thing is that the markdown-in-yaml of the CLI reference files also contain the {#syntax}
for heading IDs. It's just the source markdown files in these upstream repos that have the <a name=""></a>
markup. The empty links are converted to {#syntax}
by cli-docs-tool; https://github.com/docker/cli-docs-tool/blob/53293118a80f36cef8740c257aadba0507bdf572/markdown.go#L87-L100
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! That way, gotcha
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
@dvdksn can you open a backport for the 27.x branch? |
The right-hand toc was rendering in a janky way due to empty anchor tags