Socket
Socket
Sign inDemoInstall

@synx-ai/oas3-mdx

Package Overview
Dependencies
97
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @synx-ai/oas3-mdx

Convert OpenAPI spec to Markdown files.


Version published
Weekly downloads
6
increased by500%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

OpenAPI3 to Markdown converter

Travis Build Status GitHub Workflow Status npm npm Coveralls

Convert OpenAPI v3 spec into a directory of markdown files based on your spec paths. The purpose of this tool is to boost documentation generation and seamlessly integrate them into static site generators.

Handlebars is used to provide fully configurable templating support.

Installation

yarn

yarn add @synx-ai/openapi2md

npm

npm install @synx-ai/openapi2md

Basic usage

Options

OptionCLI argumentJavaScript parameterDefault
OpenAPI spec--specspecFileNone
Target build dir--targetoutPath./build
Templates dir--templatestemplatePath./templates

The tool will try to load the --templates relative to current working path first, then will fallback to library path.

CLI

Usage: openapi2md --specs [file] --target [target path] --templates [template path]

Options:
      --version   Show version number                         [boolean]
  -s, --spec      OpenAPI specification                      [required]
  -o, --target    target build path                [default: "./build"]
  -t, --template  templates paths              [default: "./templates"]
      --help      Show help

JavaScript

const convert = require('openapi2md').default;

convert('./example/petstore.json', './build');

Templates

For every operation in paths, object with all references resolved will be passed to templates/path.hdb, please refer to default template for an example in how to use it.

Please note that before saving, prettify will be executed to format the output, you can disable it using the <!-- prettier-ignore-start --> tag, exmaple:

<!-- prettier-ignore-start -->

<Tabs defaultValue="{{someVar}}" values={[
{{#each content}}
  { label: "{{@key}}", value: "{{@key}}" },
{{/each}}
]}>

<!-- prettier-ignore-end -->

Roadmap

  • Create a cli.js file to execute commands using yarn or npm
  • Add more configurations (ie: custom templates)
  • MDX templating support for platform that supports React components. Removed as it can be customized from current templates.
  • Add schemas and general info rendering.

Contribute

PR's are more than welcome and highly appreciated.

Keywords

FAQs

Last updated on 02 Mar 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc