jsii-docgen

October 2, 2023 ยท View on GitHub

Generates markdown reference documentation for jsii modules.

Usage

You can use this as a command line tool or as a library if you need more control.

$ jsii-docgen

Will produce a file called API.md with the api reference for this module.

As a library:

import { Documentation, Language } from 'jsii-docgen';

const docs = await Documentation.forProject('.');
const markdown = await docs.toMarkdown({ language: Language.TYPESCRIPT }).render(); // returns a markdown string

const json = await docs.toJson({ language: Language.TYPESCRIPT }).render(); // returns a JSON object

Curreently jsii-docgen supports generating documentation in the following languages:

  • TypeScript (typescript)
  • Python (python)
  • Java (java)
  • C# (csharp)
  • Go (go)

CLI Options

OptionRequiredDescription
--output, -ooptionalOutput filename (defaults to API.md if format is markdown, and API.json if format is JSON).

jsii-docgen -o ./docs/API.md
--format, -foptionalOutput format. Can be markdown or json.

jsii-docgen -f json
--language, -loptionalLanguage to generate documentation for. Can be typescript, python, java, csharp or go.

jsii-docgen -l typescript
--package, -poptionalThe name@version of an NPM package to document.

jsii-docgen -p my-package
--readme, -roptionalGenerate docs for user specified README.md.

jsii-docgen -r
--submodule, -soptionalGenerate docs for a specific submodule or "root".

jsii-docgen -s my-submodule
--split-by-submoduleoptionalGenerate a separate file for each submodule.

jsii-docgen --split-by-submodule

Contributions

All contributions are welcome, just raise an issue or submit a PR. Add a test, update readme. Do the right thing.

License

Apache 2.0