Skip to content

Commit

Permalink
fix angle brackets
Browse files Browse the repository at this point in the history
  • Loading branch information
meiji163 committed Nov 17, 2021
1 parent b5d90e1 commit 206896c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/docs/man.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func GenMan(cmd *cobra.Command, header *GenManHeader, w io.Writer) error {
}

b := genMan(cmd, header)

_, err := w.Write(md2man.Render(b))
return err
}
Expand Down Expand Up @@ -133,7 +134,13 @@ func manPreamble(buf *bytes.Buffer, header *GenManHeader, cmd *cobra.Command, da
`, header.Title, header.Section, header.date, header.Source, header.Manual))
buf.WriteString(fmt.Sprintf("%s \\- %s\n\n", dashedName, cmd.Short))
buf.WriteString("# SYNOPSIS\n")
buf.WriteString(fmt.Sprintf("**%s**\n\n", cmd.UseLine()))

// "<>" is rendered as HTML in md
synopsis := cmd.UseLine()
escAngle := strings.Replace(synopsis, "<", "\\<", -1)
escAngle = strings.Replace(escAngle, ">", "\\>", -1)
buf.WriteString(fmt.Sprintf("**%s**\n\n", escAngle))

buf.WriteString("# DESCRIPTION\n")
buf.WriteString(description + "\n\n")
}
Expand Down

0 comments on commit 206896c

Please sign in to comment.