npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@solarity/hardhat-markup

v1.0.8

Published

Customizable markdown smart contracts documentation

Downloads

393

Readme

npm hardhat

Hardhat Markup

Hardhat plugin to generate customizable smart contracts documentation.

What

This plugin generates markdown documentation of the contracts present in the project. Leveraging the natspec and solc capabilities, it is able to output beautiful uniswap-like .md files.

Installation

npm install --save-dev @solarity/hardhat-markup

Add the following statement to your hardhat.config.js:

require("@solarity/hardhat-markup")

Or, if you are using TypeScript, add this to your hardhat.config.ts:

import "@solarity/hardhat-markup"

Tasks

The documentation generation can be run either with built-in compile or the provided markup task.

To view the available options, run these help commands:

npx hardhat help compile
npx hardhat help markup

Environment extensions

This plugin does not extend the environment.

Usage

The npx hardhat markup command will compile and generate documentation for all the contracts used in the project into the default folder.

Clean old artifacts via npx hardhat clean command.

Configuration

The default configuration looks as follows. You may customize all fields in your hardhat config file.

module.exports = {
  markup: {
    outdir: "./generated-markups",
    onlyFiles: [],
    skipFiles: [],
    noCompile: false,
    verbose: false,
  },
}
  • outdir: The directory where to store the generated documentation
  • onlyFiles: If specified, documentation will be generated only for matching sources, other will be ignored
  • skipFiles: Documentation will not be generated for any matching sources, also if those match onlyFiles
  • noCompile: Skips project recompilation before the documentation generation
  • verbose: Detailed logging on generation

Including/excluding files

  • Path stands for relative path from project root to either .sol file or directory.
  • If path is a directory, all its files and sub-directories are considered matching.
  • If source is a node module, node_modules must not be present in the path.

Example

Example

Overview

License: MIT

contract Example

Author: Solidity lover

The example contract

This contract is meant to work as the example of how hardhat-markup plugin works.

In a nutshell, the plugin parses natspec documentation and presents it in a beautiful, Uniswap-like style, leveraging MD format.

You can also have code blocks inside the comments!

contract Example {
    function foo() external {
        . . .
    }
}

Events info

Random

event Random(uint256 value)

The event that emits a random value

Parameters:

| Name | Type | Description | | :---- | :------ | :--------------- | | value | uint256 | the random value |

Errors info

Oops

error Oops(string reason)

The error, occurs from time to time

Parameters:

| Name | Type | Description | | :----- | :----- | :---------- | | reason | string | the reason |

Functions info

foo (0xbd0d639f)

function foo(address user, uint256 entropy) external returns (uint256)

The very important function that computes the answer to the Universe

Parameters:

| Name | Type | Description | | :------ | :------ | :--------------------------------- | | user | address | the user who created the Universe | | entropy | uint256 | the entropy |

Return values:

| Name | Type | Description | | :--- | :------ | :-------------- | | [0] | uint256 | the answer (42) |

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/**
 * @author Solidity lover
 * @notice The example contract
 *
 * This contract is meant to work as the example of how `hardhat-markup` plugin works.
 *
 * In a nutshell, the plugin parses natspec documentation and presents it in a beautiful,
 * Uniswap-like style, leveraging MD format.
 *
 * You can also have code blocks inside the comments!
 *
 * ```solidity
 * contract Example {
 *     function foo() external {
 *         . . .
 *     }
 * }
 * ```
 */
contract Example {
    /**
     * @notice The event that emits a random value
     * @param value the random value
     */
    event Random(uint256 value);

    /**
     * @notice The error, occurs from time to time
     * @param reason the reason
     */
    error Oops(string reason);

    /**
     * @notice The very important function that computes the answer to the Universe
     * @param user the user who created the Universe
     * @param entropy the entropy
     * @return the answer (42)
     */
    function foo(address user, uint256 entropy) external returns (uint256) {
        emit Random(uint256(uint160(user)) + entropy);

        return 42;
    }
}

Known limitations

  • Vyper is currently not supported.