Skip to content

Commit 9b433b9

Browse files
committed
fix: Doc generate - Escape pipe symbols in output enums in md
This then guarantees the generated markdown cells align properly. Signed-off-by: Mihai Galos <[email protected]>
1 parent 8603d0c commit 9b433b9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/tools/gen/gendoc.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,9 @@ func (g *GenContext) renderPackage(spec *SwaggerV2Spec, parentDir string) error
293293
if err != nil {
294294
return fmt.Errorf("failed to render package %s with template, err: %s", pkg.Name, err)
295295
}
296+
escape_pipes := bytes.ReplaceAll(buf.Bytes(), []byte(" | "), []byte(" \\| "))
296297
// write content to file
297-
err = os.WriteFile(filepath.Join(parentDir, docFileName), buf.Bytes(), 0644)
298+
err = os.WriteFile(filepath.Join(parentDir, docFileName), escape_pipes, 0644)
298299
if err != nil {
299300
return fmt.Errorf("failed to write file %s in %s: %v", docFileName, parentDir, err)
300301
}

0 commit comments

Comments
 (0)