https://github.com/itsnickbarry/hardhat-docgen
Automatically convert NatSpec code comments to a static documentation site 📝
https://github.com/itsnickbarry/hardhat-docgen
blockchain buidler devdoc documentation ethereum hardhat natspec smart-contracts solc solidity userdoc vue wow
Last synced: 3 days ago
JSON representation
Automatically convert NatSpec code comments to a static documentation site 📝
- Host: GitHub
- URL: https://github.com/itsnickbarry/hardhat-docgen
- Owner: ItsNickBarry
- License: mit
- Created: 2021-01-09T19:31:34.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2025-05-07T03:36:36.000Z (5 months ago)
- Last Synced: 2025-10-03T15:24:57.133Z (9 days ago)
- Topics: blockchain, buidler, devdoc, documentation, ethereum, hardhat, natspec, smart-contracts, solc, solidity, userdoc, vue, wow
- Language: JavaScript
- Homepage:
- Size: 256 KB
- Stars: 48
- Watchers: 3
- Forks: 8
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Hardhat Docgen
Generate a static documentation site from NatSpec comments automatically on compilation with Hardhat.
## Installation
```bash
npm install --save-dev hardhat-docgen
# or
yarn add --dev hardhat-docgen
```## Usage
Load plugin in Hardhat config:
```javascript
require('hardhat-docgen');
```Add configuration under the `docgen` key:
| option | description | default |
| -------------- | ---------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| `path` | path to HTML export directory (relative to Hardhat root) | `'./docgen'` |
| `clear` | whether to delete old files in `path` on documentation generation | `false` |
| `runOnCompile` | whether to automatically generate documentation during compilation | `false` |
| `only` | `Array` of `String` matchers used to select included contracts, defaults to all contracts if `length` is 0 | `['^contracts/']` (dependent on Hardhat `paths` configuration) |
| `except` | `Array` of `String` matchers used to exclude contracts | `[]` |```javascript
docgen: {
path: './docs',
clear: true,
runOnCompile: true,
}
```The included Hardhat task may be run manually:
```bash
npx hardhat docgen
# or
yarn run hardhat docgen
```By default, the hardhat `compile` task is run before generating documentation. This behavior can be disabled with the `--no-compile` flag:
```bash
npx hardhat docgen --no-compile
# or
yarn run hardhat docgen --no-compile
```The `path` directory will be created if it does not exist.
The `clear` option is set to `false` by default because it represents a destructive action, but should be set to `true` in most cases.
## Development
Install dependencies via Yarn:
```bash
yarn install
```Setup Husky to format code on commit:
```bash
yarn prepare
```