Introducing Dodoc: A zero-config Hardhat plugin to generate documentation
0x801D
December 8th, 2021
dodoc birb
dodoc birb

Good documentation for a DeFi protocol is absolutely mandatory, but writing it can be sometimes cumbersome. Here comes Dodoc: a super simple Hardhat plugin allowing you to generate documentation for your smart contracts with no hassle!

Overview

A couple of weeks ago while wrapping up the contracts of our brand new Replicating Market Marker, we decided to have a look at the current solutions to generate and host our contracts documentation.

Finding how and where to host the docs was not a big deal, and among many different choices, our front-end team decided to go with Docusaurus and to use Markdown-based files.

The last thing to do was to find a way to automatically generate the Markdown documentation, based on the NatSpec of our Solidity contracts, and pass that to Docusaurus.

But after some research, we started to scratch our heads since we found out that the only available plugin was Hardhat Docgen, which was generating a whole static website. Not exactly what we wanted!

So we decided to have some fun and write a brand new tool from scratch: Dodoc was born!

Features

Zero-configuration required

Just install Dodoc package, import it in your Hardhat config file and you're good to go! Documentation will be generated on the next compilation in the docs folder of your repository.

Compatible with latest Solidity versions

Even the latest Solidity versions (0.8.x+) are supported, this means that you can even write documentation for your custom revert errors!

Extendibility

Default output is generating Markdown files, although custom templates can be created using Squirrelly! This means that literally any format can be supported.

Conclusion

While working on Dodoc, our goal was to make a very simple tool that would also be flexible enough to allow anyone to reuse and extend it. So we did it!

Finally, the last thing to do is to share a live example, so here is the new Primitive documentation, generated using Dodoc:

Let's try out and check out the installation instructions in the README on Github. Trust me, it's super simple!

Feel free to open any issues on Github and join us on Discord to share your thoughts and give some feedback! Happy hacking! :)

Published on Primitive

Read this on the Primitive blog: blog.

Learn More

Visit the website: primitive.finance.

Follow Primitive on twitter: primitivefi.

Arweave TX
wcHgcsZawfWev3OHO6uDa5cCxpbFnJK5oY7L6zwvENY
Ethereum Address
0x801D5e44960C5934181B04290Ec7F6A27d96cFF1
Content Digest
bk7s8ezaLmlsCzjvbVagb0JnAMrvfOSwKQzZBuHJEC4