cli-docs-tool icon indicating copy to clipboard operation
cli-docs-tool copied to clipboard

markdown: make sure we don't ignore headers with trailing whitespace

Open thaJeztah opened this issue 3 years ago • 3 comments

do we have a test for this already somewhere? (i.e. a test that combines markdown "examples" with the output generated from the command?)

thaJeztah avatar Mar 09 '22 12:03 thaJeztah

yeah we should add that case to the fixtures I think

crazy-max avatar Mar 09 '22 12:03 crazy-max

I'll try to have a look at that. I did give it a first quick try, but had trouble reading the diff 😂

thaJeztah avatar Mar 09 '22 12:03 thaJeztah

Oooooh... actually, so is this the diff from "before" I removed the testify??? If so.. then testify's diff is not very readable either 😂

=== RUN   TestGenAllTree/buildx_build.md
    clidocstool_test.go:199:
        	Error Trace:	clidocstool_test.go:199
        	Error:      	Not equal:
        	            	expected: "# docker buildx build\n\n<!---MARKER_GEN_START-->\nStart a build\n\n### Aliases\n\n`build`, `b`\n\n### Options\n\n| Name | Type | Default | Description |\n| --- | --- | --- | --- |\n| [`--add-host`](https://docs.docker.com/engine/reference/commandline/build/#add-entries-to-container-hosts-file---add-host) | `stringSlice` |  | Add a custom host-to-IP mapping (format: `host:ip`) |\n| `--allow` | `stringSlice` |  | Allow extra privileged entitlement (e.g., `network.host`, `security.insecure`) |\n| [`--build-arg`](https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables---build-arg) | `stringArray` |  | Set build-time variables |\n| `--builder` | `string` |  | Override the configured builder instance |\n| `--cache-from` | `stringArray` |  | External cache sources (e.g., `user/app:cache`, `type=local,src=path/to/dir`) |\n| `--cache-to` | `stringArray` |  | Cache export destinations (e.g., `user/app:cache`, `type=local,dest=path/to/dir`) |\n| [`--cgroup-parent`](https://docs.docker.com/engine/reference/commandline/build/#use-a-custom-parent-cgroup---cgroup-parent) | `string` |  | Optional parent cgroup for the container |\n| [`-f`](https://docs.docker.com/engine/reference/commandline/build/#specify-a-dockerfile--f), [`--file`](https://docs.docker.com/engine/reference/commandline/build/#specify-a-dockerfile--f) | `string` |  | Name of the Dockerfile (default: `PATH/Dockerfile`) |\n| `--iidfile` | `string` |  | Write the image ID to the file |\n| `--label` | `stringArray` |  | Set metadata for an image |\n| `--load` |  |  | Shorthand for `--output=type=docker` |\n| `--network` | `string` | `default` | Set the networking mode for the `RUN` instructions during build |\n| `-o`, `--output` | `stringArray` |  | Output destination (format: `type=local,dest=path`) |\n| `--platform` | `stringArray` | local | Set target platform for build |\n| `--push` |  |  | Shorthand for `--output=type=registry` |\n| `-q`, `--quiet` |  |  | Suppress the build output and print image ID on success |\n| `--secret` | `stringArray` |  | Secret file to expose to the build (format: `id=mysecret,src=/local/secret`) |\n| `--shm-size` | `string` |  | Size of `/dev/shm` |\n| `--ssh` | `stringArray` |  | SSH agent socket or keys to expose to the build (format: `default\\|<id>[=<socket>\\|<key>[,<key>]]`) |\n| [`-t`](https://docs.docker.com/engine/reference/commandline/build/#tag-an-image--t), [`--tag`](https://docs.docker.com/engine/reference/commandline/build/#tag-an-image--t) | `stringArray` |  | Name and optionally a tag (format: `name:tag`) |\n| [`--target`](https://docs.docker.com/engine/reference/commandline/build/#specifying-target-build-stage---target) | `string` |  | Set the target build stage to build. |\n| `--ulimit` | `string` |  | Ulimit options |\n\n\n<!---MARKER_GEN_END-->\n\n<!-- note that the heading below has intentional trailing whitespace -->\n\n## Examples   \n\nThis is an examples section.\n"
        	            	actual  : "# docker buildx build\n\n<!---MARKER_GEN_START-->\nStart a build\n\n### Aliases\n\n`build`, `b`\n\n### Options\n\n| Name | Type | Default | Description |\n| --- | --- | --- | --- |\n| [`--add-host`](https://docs.docker.com/engine/reference/commandline/build/#add-entries-to-container-hosts-file---add-host) | `stringSlice` |  | Add a custom host-to-IP mapping (format: `host:ip`) |\n| `--allow` | `stringSlice` |  | Allow extra privileged entitlement (e.g., `network.host`, `security.insecure`) |\n| [`--build-arg`](https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables---build-arg) | `stringArray` |  | Set build-time variables |\n| `--builder` | `string` |  | Override the configured builder instance |\n| `--cache-from` | `stringArray` |  | External cache sources (e.g., `user/app:cache`, `type=local,src=path/to/dir`) |\n| `--cache-to` | `stringArray` |  | Cache export destinations (e.g., `user/app:cache`, `type=local,dest=path/to/dir`) |\n| [`--cgroup-parent`](https://docs.docker.com/engine/reference/commandline/build/#use-a-custom-parent-cgroup---cgroup-parent) | `string` |  | Optional parent cgroup for the container |\n| [`-f`](https://docs.docker.com/engine/reference/commandline/build/#specify-a-dockerfile--f), [`--file`](https://docs.docker.com/engine/reference/commandline/build/#specify-a-dockerfile--f) | `string` |  | Name of the Dockerfile (default: `PATH/Dockerfile`) |\n| `--iidfile` | `string` |  | Write the image ID to the file |\n| `--label` | `stringArray` |  | Set metadata for an image |\n| `--load` |  |  | Shorthand for `--output=type=docker` |\n| `--network` | `string` | `default` | Set the networking mode for the `RUN` instructions during build |\n| `-o`, `--output` | `stringArray` |  | Output destination (format: `type=local,dest=path`) |\n| `--platform` | `stringArray` | local | Set target platform for build |\n| `--push` |  |  | Shorthand for `--output=type=registry` |\n| `-q`, `--quiet` |  |  | Suppress the build output and print image ID on success |\n| `--secret` | `stringArray` |  | Secret file to expose to the build (format: `id=mysecret,src=/local/secret`) |\n| `--shm-size` | `string` |  | Size of `/dev/shm` |\n| `--ssh` | `stringArray` |  | SSH agent socket or keys to expose to the build (format: `default\\|<id>[=<socket>\\|<key>[,<key>]]`) |\n| [`-t`](https://docs.docker.com/engine/reference/commandline/build/#tag-an-image--t), [`--tag`](https://docs.docker.com/engine/reference/commandline/build/#tag-an-image--t) | `stringArray` |  | Name and optionally a tag (format: `name:tag`) |\n| [`--target`](https://docs.docker.com/engine/reference/commandline/build/#specifying-target-build-stage---target) | `string` |  | Set the target build stage to build. |\n| `--ulimit` | `string` |  | Ulimit options |\n\n\n<!---MARKER_GEN_END-->\n\n"

        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -39,7 +39,2 @@

        	            	-<!-- note that the heading below has intentional trailing whitespace -->

        	            	-## Examples
        	            	-
        	            	-This is an examples section.
        	            	-
        	Test:       	TestGenAllTree/buildx_build.md

thaJeztah avatar Mar 09 '22 12:03 thaJeztah