docs: fix janky rendering of toc on docs.docker.com#5653
docs: fix janky rendering of toc on docs.docker.com#5653thaJeztah merged 1 commit intodocker:masterfrom
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 |
| directories using the `docker info` command. | ||
|
|
||
| #### <a name="log-format"></a> Daemon logging format | ||
| #### Daemon logging format {#log-format} |
There was a problem hiding this comment.
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.
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
|
@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