This repository is for create document of Capacitor Plugin.
This is example of first step of adding new plugin:
Your plugin may use @capacitor/docgen
. You should add --output-json dist/docs.json
to docgen script. example:
% docgen --api [YOUR TYPE NAME] --output-readme README.md --output-json dist/docs.json
Fork this repository. If you want, you can create a documentation for your plugin and make a pull request. Of course, you can also operate the forked repository yourself.
Case of @capacitor-community/facebook
plugin:
% npm install @capacitor-community/facebook --save-dev
Case of @capacitor-community/facebook
plugin, you should add lines:
{
"stripe": {
"name": "capacitor-community/stripe",
"repository": "https://github.com/rdlabo-team/capacitor-plugins-docs/"
},
"facebook": {
"name": "capacitor-community/facebook",
"repository": "https://github.com/rdlabo-team/capacitor-plugins-docs/"
}
}
- "facebook" is only alias. Use a name that is not already in use.
- "name" is package name of npm.
- "repository" is document repository. default is "https://github.com/rdlabo-team/capacitor-plugins-docs/". If you want to use own repository, you should change.
You should run cp -r src/docs/.template src/docs/your-alias
. Case of @capacitor-community/facebook
plugin:
% cp -r src/docs/.template src/docs/facebook
And change "app-template" to "app-[Your Alias]". All: folder name, file name, component tag.
All that's left is to write the documentation with the help of other plugins.
run:
npm start -- --plugin=stripe
To build the app for production, run:
npm run build -- --plugin=stripe
update docs:
npm run docs
This markdown use Zenn Editor. So you can use zenn's markdown notation. List is here:
https://zenn.dev/zenn/articles/markdown-guide
And added custom notation of add types. If your plugin has createPaymentSheet
interface, you can:
!::createPaymentSheet::
This will paste the type information of createPaymentSheet.