Repository navigation
fix(core): escape pipes in generated argument tables - #6359
Merged
elwinar merged 5 commits intoOct 15, 2026
Merged
Conversation
elwinar
previously approved these changes
Oct 6, 2026
remyleone
reviewed
Oct 6, 2026
|
|
||
| // Exported for black-box tests of the table cell escaping. | ||
|
|
||
| func EscapeTableCell(s string) string { |
Member
There was a problem hiding this comment.
Why not just export the function?
Contributor
Author
There was a problem hiding this comment.
Thanks for review. I've exported the function directly and removed export_test.go
remyleone
reviewed
Oct 6, 2026
Member
|
Thanks for your contribution @WynandVStaden could you sign your commits? |
The doc generator wrote an argument's description straight into a Markdown table cell. A description containing "|", such as the list of accepted values for `scw instance server create ip=`, ended the cell early and pushed the rest of the row into extra columns. Escape "|" in the description cell and regenerate the three command pages that had a broken row: instance, block and redis. Closes scaleway#6354
golangci-lint's testpackage rule requires tests to live in a _test package. Expose escapeTableCell through export_test.go, as internal/namespaces/rdb does, and call it from package docgen_test.
The package is internal, so exporting the helper costs nothing and removes the need for export_test.go.
WynandVStaden
force-pushed
the
fix/docgen-escape-table-pipes
branch
from
October 6, 2026 14:02
c13955b to
1f7a087
Compare
Contributor
Author
I signed commits thanks |
…le-pipes # Conflicts: # docs/commands/block.md
elwinar
enabled auto-merge
October 15, 2026 08:39
elwinar
approved these changes
Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Community Note
Closes #6354
What is wrong
internal/docgen/main.md.tmplwrites each argument's description straight into a Markdown table cell:When the description contains a
|, the cell ends there and the rest of the row spills into extra columns. That is what breaks theiprow ofscw instance server create, whose description ends with(new | ipv4 | ipv6 | both | dynamic | none | <id> | <address>).The change
internal/docgen/docgen.go: a smallEscapeTableCellhelper that replaces|with\|, registered as theescape_table_celltemplate function.internal/docgen/main.md.tmpl: the description cell goes through it.internal/docgen/docgen_test.go: one assertion on a multi-pipe description, in packagedocgen_test.docs/commands/: regenerated. Three pages change, because the same bug had hit two more rows than the one reported:instance.mdserver create→ip(new(new | ipv4 | ipv6 | both | dynamic | none | <id> | <address>)block.mdvolume createandvolume update→perf-iopsredis.mdacl update→zoneThe rest of each diff is
rumdlre-padding the columns of those tables.I only escaped the description column. The third column (
arg_spec_flag) is built from defaults and enum values, and no page currently has a|there; say so if you would like it covered too.How I checked
Run on Windows 11 with Go 1.27.1 and rumdl 0.2.78:
go test ./internal/docgen/passes;go build ./...andgo vet ./internal/docgen/ ./cmd/scw-doc-gen/are clean.go run ./cmd/scw-doc-gen -outdir ./docs/commandsfollowed byrumdl fmt -s ./docson unmodifiedmainreproduces the committed docs exceptautocomplete.md, where the default shell is read from the machine. With this branch the only further differences are the three pages above. I leftautocomplete.mdout of the commit.rumdl checkon the three pages reports no issues.golangci-lint run ./internal/docgen/... ./cmd/scw-doc-gen/...(v2.13.0) reports 0 issues. The first push failed CI on thetestpackagerule because I had not run the linter; the later commits fix that and, following review, export the helper directly.Not run locally:
typosand the fullmise run ci.docs/commands/dedibox.mdalso has a description with a|(Filter by IP type (server | rpnv2_subnet)), but the generator does not write that page any more, so I did not touch it.