cobra icon indicating copy to clipboard operation
cobra copied to clipboard

GenMarkdownTree creates header level 2 instead of header level 1

Open zchenyu opened this issue 1 year ago • 2 comments

It generates

## my-command
...

instead of

# my-command
...

The absence of a header level 1 messes up the table of contents generation for certain docs, like mkdocs with the material theme.

Does it make sense to reduce the levels by 1 for all the headers? https://github.com/spf13/cobra/blob/v1.7.0/doc/md_docs.go#L62

zchenyu avatar Apr 10 '23 17:04 zchenyu

(This is hitting us with Docusaurus as well.)

Would a patch to add an indentation level control be accepted?

evankanderson avatar Oct 30 '23 06:10 evankanderson

Would also be nice to have an option to inline subcommands on the same page instead of splitting it out into new files. This would also help with Docusaurus since then the commands would render as part of the page TOC instead of in the sidebar.

johnrengelman avatar May 02 '24 02:05 johnrengelman