OpenZeppelin / solidity-docgen

Documentation generator for Solidity projects
MIT License
441 stars 116 forks source link

Add `relativePath` property which is displayed for Contracts #416

Closed tim-becker closed 1 year ago

tim-becker commented 1 year ago

One downside to the single page layout is that the objects' file paths are lost. This change displays the relative file paths for each contract object

frangio commented 1 year ago

Hey @tim-becker, sorry I'm just now seeing this. Can you share an example situation where you'd want to show the relative path?

tim-becker commented 1 year ago

@frangio Sure. We are using this repo to generate docs for our solidity SDK. We prefer the single page layout, but we want the relative path of each object to be displayed so that users know the relative path to import when using our SDK.

frangio commented 1 year ago

Resolved by https://github.com/OpenZeppelin/solidity-docgen/commit/1841eebf65fabe7e8956e5ae197af8741942e758.

I ended up adding relativePath as a property in context.file, so you would access it in a template by:

File: `{{__item_context.file.relativePath}}`