Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tsuberim/soldoc

A documentation generator for solidity projects, inspired by TypeDoc.
https://github.com/tsuberim/soldoc

documentation documentation-generator documentation-tool ethereum json markdown nodejs npm solidity truffle

Last synced: 15 days ago
JSON representation

A documentation generator for solidity projects, inspired by TypeDoc.

Awesome Lists containing this project

README

        

# SolDoc

[![NPM Package](https://img.shields.io/npm/v/@soldoc/soldoc.svg?style=flat-square)](https://www.npmjs.org/package/@soldoc/soldoc)

> A documentation generator for solidity projects, inspired by [TypeDoc](http://typedoc.org/).

## Usage

SolDoc can be used as a CLI app or as a library and called from your code.

### As a CLI tool

1. Install: `yarn global add @soldoc/soldoc` / `npm i -g @soldoc/soldoc`.
2. Use the CLI:
```
Usage: cli.js --in -o

Options:
--help Show help [boolean]
--version Show version number [boolean]
--options Path to JSON config file
--in Specifies the location the input files should be read from.
[string] [default: "./contracts"]
--json, -j Output the parsed information to a json file instead of
rendering. [string]
--out, -o Specifies the location the documentation should be written to. [string] [default: "./docs"]
--quiet, -q No stdout output [boolean] [default: false]
--theme, -t Specifies a npm module that exports a default
`render(filepath,contractName,contactInfo,options):
{content,extension}` function
[string] [default: "@soldoc/markdown"]
--repo-url, -r Specifies remote repository url. Uses `repository` field in
`package.json` if available and not specified. [string]
--log, -l Specifies the location the log file should be written to.
[string]

Examples:
cli.js --in ./contracts -o ./docs Render `.sol` files in `./contracts` into
`.docs`

For more information, visit https://github.com/dev-matan-tsuberi/soldoc
```

### As a library

1. Install: `yarn add --dev @soldoc/soldoc` / `npm i --save-dev @soldoc/soldoc`.
2. Import in your project as:
```JavaScript
import soldoc from '@soldoc/soldoc';

/* default options */
soldoc.defaults = {
in: './contracts',
out: './docs',
/* json: undefined, */
/* repoUrl: undefined, */
/* log: undefined, */
quiet: false,
theme: '@soldoc/markdown',
};
soldoc(options); // returns a promise
```

## Themes

SolDoc is easily themeable, installing a theme is as simple as `yarn add @soldoc/` / `npm i --save @soldoc/` and setting a configuration option:
1. In the cli: `soldoc --theme @soldoc/`.
2. In code: `soldoc({theme: '@soldoc/'})`.

Currently the official themes are:
1. [![NPM Package](https://img.shields.io/npm/v/@soldoc/markdown.svg?style=flat-square)](https://www.npmjs.org/package/@soldoc/markdown) [@soldoc/markdown](packages/markdown) **\*Default\*** - A simple markdown theme.
2. [![NPM Package](https://img.shields.io/npm/v/@soldoc/json.svg?style=flat-square)](https://www.npmjs.org/package/@soldoc/json) [@soldoc/json](packages/json) - A theme that just outputs a JSON object.
2. [Create a theme!](docs/create_a_theme.md)

You can pass custom options to `` under it's name, example:

options.json
```
{
...
"theme": "@soldoc/markdown",
"@soldoc/markdown": {
...
}
}
```

## Contribute

Get started:

1. `git clone [email protected]:dev-matan-tsuberi/soldoc.git && cd soldoc`
2. `yarn`
3. `yarn lerna bootstrap`
4. Done.

**Note**: This project is managed as a **monorepo** and uses [lerna.js](https://lernajs.io/).

This project needs contributors!
Pull requests are very welcome and needed.
Check out [issues with label `help wanted`](https://github.com/dev-matan-tsuberi/soldoc/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) to get started.