Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
A CLI tool to transform Swagger/OpenAPI/AsyncAPI docs to beautiful HTML pages via Shins/Widdershins
A CLI tool to transform Swagger/OpenAPI/AsyncAPI docs to beautiful HTML pages via Shins/Widdershins.
You can find an example generated page at http://tobilg.github.io/api2html/petstore/.
To install api2html
globally, use
$ npm i api2html -g
You can also install it to use as devDependencies
, and use it locally via a npm run
task in your package.json
:
$ npm i api2html --save-dev
Usage in package.json
:
{
"scripts": {
"api-docs": "node_modules/.bin/api2html -o docs/api.html -l shell,javascript--nodejs docs/openapi/api.yml"
}
}
$ api2html --help
Usage: api2html [options] <sourcePath>
Options:
-V, --version output the version number
-r, --resolve <source> resolve external dependencies, source should be a url or a path
-o, --out <outputPath> output path for the resulting HTML document
-t, --theme <themeName> theme to use (see https://highlightjs.org/static/demo/ for a list)
-c, --customLogo <logoPath> use custom logo at the respective path
-C, --customCss use custom css
-P, --customCssPath <cssPath> use custom css file
-i, --includes <includesList> comma-separated list of files to include
-l, --languages <languageList> comma-separated list of languages to use for the language tabs (out of shell, http, javascript, javascript--nodejs, ruby, python, java, go)
-s, --search enable search
-S, --summary use summary instead of operationId for TOC
-b, --omitBody Omit top-level fake body parameter object
-R, --raw Show raw schemas in samples, not example values
-h, --help output usage information
This will render the api.yml
file in the current directory as myapi.html
file in the current directory.
$ api2html -o myapi.html myapi.yml
This will render the api.yml
file in the current directory as myapi.html
file in the same directory, and use the custom logo mylogo.png
.
$ api2html -o myapi.html -c mylogo.png myapi.yml
This will render the api.yml
file in the current directory as myapi.html
file in the same directory, and use go
and javascript
examples.
$ api2html -o myapi.html -l go,javascript myapi.yml
This will render the api.yml
file in the current directory as myapi.html
file in the same directory, and use go
and javascript
examples, as well as a different syntax higlighter from highlight.js.
$ api2html -o myapi.html -l go,javascript -t arta myapi.yml
If you add refs to external files in your source file, you can enable them by using -r <source>
. The following command will resolve all your relative imports from the current directory.
$ api2html -o myapi.html -r ./ myapi.yml
FAQs
A CLI tool to transform Swagger/OpenAPI/AsyncAPI docs to beautiful HTML pages via Shins/Widdershins
The npm package api2html receives a total of 801 weekly downloads. As such, api2html popularity was classified as not popular.
We found that api2html demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.