RenderHelpMarkdown prints markdown formatted help for a single component or for all of them (with name = '*'), and renders it so that it can be printed on a terminal.
(w io.Writer, name string, comp Components)
| 12 | // for all of them (with name = '*'), and renders it so that it can be |
| 13 | // printed on a terminal. |
| 14 | func RenderHelpMarkdown(w io.Writer, name string, comp Components) error { |
| 15 | r, _ := glamour.NewTermRenderer( |
| 16 | // detect background color and pick either the default dark or light theme |
| 17 | glamour.WithAutoStyle(), |
| 18 | // wrap output at specific width |
| 19 | glamour.WithWordWrap(int(terminalWidth())), |
| 20 | ) |
| 21 | |
| 22 | if err := PrintHelp(r, name, comp, HelpFormatMarkdown); err != nil { |
| 23 | return err |
| 24 | } |
| 25 | |
| 26 | r.Close() |
| 27 | _, err := io.Copy(w, r) |
| 28 | return err |
| 29 | } |
| 30 | |
| 31 | // GenerateMarkdownHelp generates markdown-formatted textual help for a Baker |
| 32 | // component from its description structure. Markdown is written into w. |