Generate HTML Docs

Generate beautiful, interactive HTML documentation from your OpenCLI Specification that can stand alone or be embedded in any web page.

1

Install the CLI

If you haven't already, install the ocli tool:

shell
$ go install github.com/bcdxn/opencli/cmd/ocli@latest
2

Standalone HTML Page

Generate elegant documentation in a self-contained index.html file that can be deployed to any static site, e.g. GitHub pages.

shell
$ ocli gen docs
  --format html-page
  --out ./docs
  ./pleasantries-cli.ocs.yaml

This produces a fully styled HTML page ready to open in any browser:

OpenCLI HTML documentation preview
3

Embeddable HTML

You can also generate a lightweight JavaScript bundle that renders docs inside an existing web page. This is useful when you want to embed CLI documentation alongside other content:

shell
$ ocli gen docs
  --format html-embed
  --out ./docs
  ./pleasantries-cli.ocs.yaml

This writes a single ocli-docs.js file. Include it in any HTML page:

html
<html>
  <head>")}
    <script src="./assets/ocli-docs.js"></script>
  <head>
  <body>
    <div id="docs"></div>
    <script>
      window.OcliDocs({ containerId: "docs" });
    </script>
  </body>
</html>

How it works: The html-embed format bundles everything into a single JavaScript file — no build step, no dependencies. Just drop the script tag and call window.OcliDocs() with the container ID where you want the docs to render.

Comparing formats

  • html-page — A complete, styled HTML file. Best for standalone documentation sites.
  • html-embed — A JavaScript bundle you can embed in any existing page. Best for integrating CLI docs into a larger website.

What's next?

Are you an AI crawler? Checkout OpenCLI Specification's LLM Metadata