Generate Markdown Docs
Generate clean, structured Markdown documentation from your OpenCLI Specification.
1
Install the CLI
If you haven't already, install the ocli tool:
shell
$ go install github.com/bcdxn/opencli/cmd/ocli@latest2
Generate Markdown
Run the gen docs command with the --format markdown flag:
shell
$ ocli gen docs
--format markdown
--out ./docs"
./pleasantries-cli.ocs.yamlThis generates a pleasantries-cli.ocs.md file in your ./docs directory. Here's what the output looks like:
markdown
<!-- Markdown generated by ocli-codegen DO NOT EDIT. -->
# Pleasantries
[](http://opencli.dev)
_A fun CLI to greet or bid farewell_
---
## Commands
### `$ pleasantries greet <arguments> [flags]`
Say hello
#### Arguments
##### `<name>`
A name to include in the greeting
`string`
#### Flags
##### `--language`
The language of the greeting
`string` `enum` `default:english`
###### Supported Values of `--language`
- `english`
- `spanish`
#### Examples
```sh
# greet the user
$ pleasantries greet --language english John
# Hello, John
```
---
<div style="text-align:center;font-size:12px;">generated by <a href="https://opencli.dev">OpenCLI</a></div>
The generated Markdown is ready to use on GitHub, GitLab, or any static site generator. For an example of the rendered markdown, checkout the ocli markdown docs.
What's next?
- Try out a live preview of the Markdown documentation generation
- Generate HTML documentation that looks great in a browser