Skip to content

Commit b4c0586

Browse files
committed
doc: Put description in separate section
The `Long` description was prepended to the Synopsis section which it does not belong to - the synopsis should, by convention, only be the syntax of the command and its options. It's now added to a separate Description section.
1 parent 61968e8 commit b4c0586

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

doc/md_docs.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,19 @@ func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string)
6363

6464
buf.WriteString("## " + name + "\n\n")
6565
buf.WriteString(cmd.Short + "\n\n")
66-
if len(cmd.Long) > 0 {
67-
buf.WriteString("### Synopsis\n\n")
68-
buf.WriteString(cmd.Long + "\n\n")
69-
}
7066

7167
if cmd.Runnable() {
68+
if len(cmd.Long) > 0 {
69+
buf.WriteString("### Synopsis\n\n")
70+
}
7271
fmt.Fprintf(buf, "```\n%s\n```\n\n", cmd.UseLine())
7372
}
7473

74+
if len(cmd.Long) > 0 {
75+
buf.WriteString("### Description\n\n")
76+
buf.WriteString(cmd.Long + "\n\n")
77+
}
78+
7579
if len(cmd.Example) > 0 {
7680
buf.WriteString("### Examples\n\n")
7781
fmt.Fprintf(buf, "```\n%s\n```\n\n", cmd.Example)

0 commit comments

Comments
 (0)