Giter Site home page Giter Site logo

ionic-team / capacitor-docgen Goto Github PK

View Code? Open in Web Editor NEW
12.0 12.0 8.0 497 KB

Docs Readme Markdown and JSON Generator for Capacitor Plugins.

Home Page: https://capacitorjs.com/

License: Other

JavaScript 1.00% TypeScript 99.00%
capacitor capacitor-plugin docs-generator

capacitor-docgen's Introduction

@capacitor/docgen

Docs Readme Markdown and JSON Generator for Capacitor Plugins.

  • Designed specifically for generating docs for Capacitor plugins using TypeScript
  • Generates docs data pulled from JSDocs within source code
  • Replaces placeholders within existing README.md markdown files with the generated docs
  • Outputs a json file of the raw docs data
  • Ideal for formatted docs within Github and NPM readme landing pages
  • If you're looking for an entire docs site generator we recommend TypeDoc instead
npm i @capacitor/docgen --save-dev

Example Readme File

# My Capacitor Plugin ๐Ÿ”Œ

The readme file can be formatted however you'd like. Just insert
the docgen placeholder elements where the index of the API methods,
and the API docs should go.

Below is an index of all the methods available.

<docgen-index></docgen-index>

## Custom Readme Content

Manage your readme content however, and on every `docgen` rebuild
it will leave the original content as is, but update the inner text 
of the docgen placeholder elements with the updated generated docs.

<docgen-api></docgen-api>

## Commit Your Readme ๐Ÿš€

The benefit of this readme file is that is also acts as the landing 
page for the Github repo and NPM package, and the anchors within the 
docs can also be linked to and shared.

CLI

The easiest way to run docgen is to install @capacitor/docgen as a dev dependency and add the command to the package.json scripts. In the example below, HapticsPlugin is the primary interface:

docgen --api HapticsPlugin --output-readme README.md
Flag Alias Description
--api -a The name of the primary application programming interface. Required
--output-readme -r Path to the markdown file to update. Note that the file must already exist. Required
--output-json -j Path to write the raw docs data as a json file.
--project -p Path to the project's tsconfig.json file, same as the project flag for TypeScript's CLI. By default it'll attempt to find this file.

package.json script

{
  "scripts": {
    "docgen": "docgen --api HapticsPlugin --output-readme README.md"
  }
}

API

The same API that's available to the CLI can also be imported from @capacitor/docgen.

Related

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.