-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
forge doc: links to functions or objects in other files don't work #9506
Comments
Het @lilyanB that's not the way natspec inheritance work, please check https://docs.soliditylang.org/en/latest/natspec-format.html#inheritance-notes Please open a ticket if you see problems with using inheritdoc. Thank you |
Thanks for your explanation. I have pushed code with another bug I think. there is no documentation in the function accessible directly to the parent of the current contract: |
that's still not how @inheritdoc works, should be something like diff --git a/src/Counter.sol b/src/Counter.sol
index 2c0a207..90e9f27 100644
--- a/src/Counter.sol
+++ b/src/Counter.sol
@@ -10,8 +10,8 @@ contract Counter is ParentCounter, ICounter {
return 100;
}
- /// @notice more info in {testParentFunction}
- function testFunctionWithParent() public pure returns (uint256) {
- return testParentFunction();
+ /// @inheritdoc ParentCounter
+ function testFunctionWithParent() public pure override returns (uint256) {
+ return super.testFunctionWithParent();
}
}
diff --git a/src/ParentCounter.sol b/src/ParentCounter.sol
index 4be1482..d48faeb 100644
--- a/src/ParentCounter.sol
+++ b/src/ParentCounter.sol
@@ -2,7 +2,8 @@
pragma solidity ^0.8.13;
contract ParentCounter {
- function testParentFunction() public pure returns (uint256) {
+ /// @notice info for ParentCounter.testFunctionWithParent function
+ function testFunctionWithParent() public pure virtual returns (uint256) {
return 100;
}
} |
Thanks for your example. But I want to create a link to the parent contract. When the user clicks on it, it will move directly to the ParentCounter.testparentfunction doc.
|
@grandizzy the problem is that link resolution in generated docs does not work as it should. The source code in https://github.com/foundry-rs/foundry/blob/539760c2d158c91c28cc3d3400963e09f49882ba/crates/doc/src/preprocessor/infer_hyperlinks.rs suggests that links in the format As @lilyanB described, links to functions within the same file are resolved correctly, but links to functions in the parent contract are not resolved. // file A.sol
contract A {
function foo() external {}
} // file B.sol
import { A } from "./A.sol";
contract B is A {
/**
* @notice You should call {foo} or {A-foo} before calling this function
*/
function bar() external {}
} The links to Could you re-open the issue please? |
Ah, I see, reopening to check above. Thanks |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0
What command(s) is the bug in?
forge doc --build --serve
Operating System
Linux
Describe the bug
Hello, I need help with the forge doc please.
When I build the doc, some links to functions/objects in the parent contract (when your contract is inherited from the library) don't work. I have created a repo to view a simple example of code: https://github.com/lilyanB/testFoundry/blob/master/src/libraries/lib.sol#L6
The result when I run
forge doc --build --serve
:Thanks
The text was updated successfully, but these errors were encountered: