foundry icon indicating copy to clipboard operation
foundry copied to clipboard

feat: `forge doc`

Open rkrasiuk opened this issue 3 years ago • 5 comments

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 doc crate with sample doc output struct
  • [ ] reuse fmt's Visitor for parsing source files
  • [ ] create default templates
  • [ ] render the doc output into templates

References:

Additional context

No response

rkrasiuk avatar May 20 '22 07:05 rkrasiuk

another (better imo) reference: https://github.com/primitivefinance/primitive-dodoc

transmissions11 avatar May 20 '22 08:05 transmissions11

nice find! including into the list

rkrasiuk avatar May 20 '22 08:05 rkrasiuk

taking a look at this, currently working on a proof of concept, will send PR later to start discussion on details

0xYYY avatar Jun 14 '22 15:06 0xYYY

https://github.com/ZeframLou/foundry-docgen

odyslam avatar Jun 29 '22 04:06 odyslam

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

onbjerg avatar Jul 01 '22 18:07 onbjerg

Outstanding items for #2701:

  • [x] Render top level funcs/structs/events. Currently, forge doc renders 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 DocConfig with foundry config
  • [ ] Add contributor docs to the doc crate (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

rkrasiuk avatar Oct 27 '22 13:10 rkrasiuk

+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.

samlaf avatar Dec 23 '22 13:12 samlaf