-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix(forge doc): use relative path instead of full path #12373
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
fix(forge doc): use relative path instead of full path #12373
Conversation
| } | ||
|
|
||
| fn try_relative_output_path(&self) -> Option<&Path> { | ||
| self.target_path.strip_prefix(&self.out_target_dir).ok()?.strip_prefix(DocBuilder::SRC).ok() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still need this, as docs target paths are composed prefixed with SRC here:
foundry/crates/doc/src/builder.rs
Line 194 in 87a024e
| let target_path = out_dir.join(Self::SRC).join(relative_path); |
foundry/crates/doc/src/builder.rs
Line 219 in 87a024e
| let target_path = out_dir.join(Self::SRC).join(relative_path); |
foundry/crates/doc/src/builder.rs
Line 247 in 87a024e
| let target_path = out_dir.join(Self::SRC).join(relative_path); |
so it's a doubled src e.g. target path is /home/flow/docs/src/src/interfaces/IFlowNFTDescriptor.sol/interface.IFlowNFTDescriptor.md and out target is /home/flow/docs hence relative path will result in doubled src. Or we could just not join src in target dirs, maybe that's better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added strip_prefixback there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!
Motivation
Fix issue described here: #12361
Solution
Fix forge doc hyperlinks to use relative paths
Added a test on
doc.rsto ensure paths are no longer relative.PR Checklist