Skip to content

Split docs to separate files#506

Merged
tonistiigi merged 9 commits intodocker:masterfrom
thaJeztah:split_docs
Mar 25, 2021
Merged

Split docs to separate files#506
tonistiigi merged 9 commits intodocker:masterfrom
thaJeztah:split_docs

Conversation

@thaJeztah
Copy link
Member

This moves the reference docs to the docs directory, splitting the readme to dedicated markdown files for each subcommand.

See individual commits for more details; with this change, #91 is able to include the extended descriptions and examples in the generated YAML docs, which are used for docs.docker.com; I opened a draft PR that updates the docs based on this pull request: docker/docs#12092; preview here; https://deploy-preview-12092--docsdocker.netlify.app/

@@ -0,0 +1,32 @@
# buildx
Copy link
Member Author

Choose a reason for hiding this comment

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

Note; moving the docs to be in docs/reference; this is more in line with other repositories that generate yaml docs (for integration in docs.docker.com); having these in a separate directory keeps the top docs/ directory available for other (non-reference) docs. If we don't anticipate other docs to be added, we could move to the top-level docs/

@@ -159,697 +159,6 @@ Currently, the bake command supports building images from compose files, similar

There is also support for custom build rules from HCL/JSON files allowing better code reuse and different target groups. The design of bake is in very early stages and we are looking for feedback from users.
Copy link
Member Author

Choose a reason for hiding this comment

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

Probably could move the "introduction" part to be included in the buildx top-level command, but can do that in a follow-up.

+ [`buildx bake [OPTIONS] [TARGET...]`](#buildx-bake-options-target)
+ [`buildx imagetools create [OPTIONS] [SOURCE] [SOURCE...]`](#buildx-imagetools-create-options-source-source)
+ [`buildx imagetools inspect NAME`](#buildx-imagetools-inspect-name)
+ [`buildx build [OPTIONS] PATH | URL | -`](docs/reference/buildx_build.md)
Copy link
Member Author

Choose a reason for hiding this comment

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

Perhaps we should simplify these to be just buildx build (not listing the options/usage)

@crazy-max
Copy link
Member

@thaJeztah That's really cool thanks for that! See also #504 about a recent change with the --progress flag for buildx build and buildx bake. Maybe add a note about that new env var?

@thaJeztah
Copy link
Member Author

See also #504 about a recent change with the --progress flag for buildx build and buildx bake. Maybe add a note about that new env var?

Oh! Thanks for the link. We need to be a bit creative, because that option is not yet in the version of buildx that's currently shipping with Docker Desktop. I can create some follow-up PRs after this, and we can time merging those in the right order (so that I can generate the docs from master until these changes are in a release).

@crazy-max
Copy link
Member

@thaJeztah Yes exactly not yet released, like you said a follow-up PR is a good move everytime the doc is impacted. Btw, there is also BUILDX_BUILDER to take into account.

@thaJeztah thaJeztah marked this pull request as ready for review January 13, 2021 18:59
@tonistiigi
Copy link
Member

I think having the command outputs copy-pasted from the user's terminals is very error-prone. If we are going with this way then please add a script that generates them and validates that they are up-to-date in the CI. Should be easy to run buildx in a container or in a Dockerfile and copy outputs to the scratch stage.

I do think having separate pages affects the readability, especially in github where there is no sidebar. We should add extra links back to the TOC from a Documentation section in the page so if someone reads through the page they realize there is more context in the separate pages. If possible we could also consider adding markers to the main readme instead of separate pages to have the possibility to separate commands .

@dieucao
Copy link

dieucao commented Feb 24, 2021

Was chatting with @tonistiigi and I wondered if it might make sense to have a single page with multiple section links similar to how the Dockerfile reference is laid out at https://docs.docker.com/engine/reference/builder/ with section links along the right side, instead of splitting into multiple pages, as that seems a little closer to how it's laid out on the buildx Readme currently. @usha-mandya thoughts?

@usha-mandya
Copy link
Member

Dieu, thanks for looping me in. I believe a separate page for each sub command makes sense as a single page with all the commands and their extended descriptions might increasing the page scroll. With a page each for the subcommands, readers will still be able to access other commands using the left nav. This is also inline with all other pages in the CLI reference section.

@tonistiigi tonistiigi force-pushed the split_docs branch 4 times, most recently from fe10ff1 to e16125c Compare March 23, 2021 18:10
@tonistiigi
Copy link
Member

Added generators from code and CI validation. Let's get this merged.

@thaJeztah Didn't make text changes. What's left is TOC visibility in the main readme and fix the titles of the flag definitions. These are not "examples" (that are not organized in any way so the only way to find information is to read through the whole page), but descriptions for the flags. Of course, flag descriptions can have examples and there can be general examples in a special section. If you need any more markers or yaml output, they can be added (probably in follow-up).


## Examples

### <a name="platform"></a> Set the target platforms for the build (--platform)
Copy link
Member Author

Choose a reason for hiding this comment

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

Let me try updating my docs PR, and see if it likes this, or if it expects the "extended" syntax; https://www.markdownguide.org/extended-syntax/#heading-ids

Suggested change
### <a name="platform"></a> Set the target platforms for the build (--platform)
### Set the target platforms for the build (--platform) {#platform}

Copy link
Member

Choose a reason for hiding this comment

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

If they are functionally equivalent then we can use the markdown style. Need to update the generator as well as it is looking for HTML style marker atm. to see if link is possible.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, I tried manually updating to the markdown syntax in docker/docs#12092 (preview at https://deploy-preview-12092--docsdocker.netlify.app/engine/reference/commandline/buildx_build/

So both work, but looks like the Markdown syntax works better, and is cleaner; in that case Jekyll accepts the custom ID; skipping its own generated one. So in that case there won't be two IDs (one custom and one generated);

Before:

Screenshot 2021-03-24 at 16 14 43

After (with Markdown syntax):

Screenshot 2021-03-24 at 16 41 23

I haven't tested what it looks like on GitHub though. Let's try if it works in this comment

Example with custom anchor-id {#mycustomid}

this is a link to the custom ID

Sigh... doesn't seem to work in GFM 😞 (I hate all the different flavours of markdown); https://github.github.com/gfm/

Let me dig a bit more to see if it's possible, otherwise we use the current approach

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like it's not possible with GitHub's markdown flavour, so let's keep the markdown as-is; perhaps I'll change the yamldocs generator to change it, but that's not for this PR

thaJeztah and others added 9 commits March 25, 2021 00:37
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Use the usage output of `--help` for each subcommand, to make
sure all flags/options are included on the page, and to make
it easier to keep docs in sync.

Note that the usage output is only used when reading these
docs on GitHub; docs.docker.com only consumes the "description"
and "example" sections (when present), and generates flag information
and usage output from source

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Put the flag descriptions/examples under an "examples"
section (used at docs.docker.com), and rephrase the
headings to be more consistent with other pages in the
docker documentation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Copy link
Member Author

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah
Copy link
Member Author

@tonistiigi I think this is good to merge (thanks for writing the generator code!); we can further improve after this

@tonistiigi tonistiigi merged commit 0147b92 into docker:master Mar 25, 2021
@tonistiigi tonistiigi mentioned this pull request Mar 25, 2021
@thaJeztah thaJeztah deleted the split_docs branch March 25, 2021 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants