Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(doc): infer hyperlinks for {Contract}, {function}, and {Contract-function} references #4541

Closed
PaulRBerg opened this issue Mar 12, 2023 · 3 comments · Fixed by #6626
Closed
Labels
C-forge Command: forge Cmd-forge-doc Command: forge doc T-feature Type: feature

Comments

@PaulRBerg
Copy link
Contributor

PaulRBerg commented Mar 12, 2023

Component

Forge

Describe the feature you would like

It is a fairly common strategy to refer to other functions and contracts by using {} brackets in NatSpec comments. OpenZeppelin does this, for instance:

I imagine that the algorithm would go something like this in Forge:

  • {Contract}: link to the contract page, e.g. /src/Contract.sol/contract.Contract.md
  • {function} (or {event}}: relative link in the same document with #, e.g. #-function
  • {Contract-function}: link to the contract page and the function section by adding a # in the URL, e.g. /src/Contract.sol/contract.Contract.md#function
@PaulRBerg PaulRBerg added the T-feature Type: feature label Mar 12, 2023
@mds1 mds1 added C-forge Command: forge Cmd-forge-doc Command: forge doc labels Mar 13, 2023
@mds1
Copy link
Collaborator

mds1 commented Mar 13, 2023

I wonder why OZ does {Contract-function}, I feel like {Contract.function} is more common? Either way don't feel strongly, and supportive of this feature request 👍

cc @rkrasiuk

@PaulRBerg
Copy link
Contributor Author

Not sure why OZ decided to go with that format, but I like it. I wouldn't use dot notation in NatSpec comments since I'd prefer to separate actual syntax from documentation references.

@benbcjdev
Copy link

I know it's been a while but I want to add support for this feature, would love to be able to automatically hyperlink to other methods/contracts in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge Cmd-forge-doc Command: forge doc T-feature Type: feature
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants