foundry
foundry copied to clipboard
feat: `forge doc`
Component
Forge
Describe the feature you would like
This feature request is a tracker for forge doc subcommand that, given the solidity source files, generates an mdbook-like documentation with an option to serve it.
Tasks:
- [ ] create a
doccrate with sample doc output struct - [ ] reuse fmt's
Visitorfor parsing source files - [ ] create default templates
- [ ] render the doc output into templates
References:
Additional context
No response
another (better imo) reference: https://github.com/primitivefinance/primitive-dodoc
nice find! including into the list
taking a look at this, currently working on a proof of concept, will send PR later to start discussion on details
https://github.com/ZeframLou/foundry-docgen
See my comment here on ideas I had for forge doc: https://github.com/foundry-rs/foundry/issues/1410#issuecomment-1109824780
Also see the original issue: https://github.com/foundry-rs/foundry/issues/1410#issue-1214179443
I've closed that issue to roll it up into this one
Outstanding items for #2701:
- [x] Render top level funcs/structs/events. Currently,
forge docrenders only contracts and all it's children items as the output. Provide a way to handle other top level items. - [ ] Test coverage for
DocParser&DocBuilder - [x] Merge
DocConfigwith foundry config - [ ] Add contributor docs to the
doccrate (that's on me) - [ ] Investigate unreachable items https://github.com/foundry-rs/foundry/blob/d9965ef65cab71a96a5efaa5e88c3800634e277c/doc/src/as_code.rs#L94-L97
- [x] Clean up code
+1. Would really like to use this feature. In the meantime, I'm using https://github.com/OpenZeppelin/solidity-docgen combined with https://book.getfoundry.sh/config/hardhat, but it would be nice not to have to pollute our project with hardhat stuff only for generating documentation.