Skip to content

Conversation

@marcvernet31
Copy link
Contributor

Motivation

Fix issue described here: #12361

Solution

Fix forge doc hyperlinks to use relative paths

  • Generate relative links like /src/... instead of absolute filesystem paths
  • Ensure consistent path handling across builder, document, inheritance, and writer

Added a test on doc.rs to ensure paths are no longer relative.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

}

fn try_relative_output_path(&self) -> Option<&Path> {
self.target_path.strip_prefix(&self.out_target_dir).ok()?.strip_prefix(DocBuilder::SRC).ok()
Copy link
Collaborator

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:

let target_path = out_dir.join(Self::SRC).join(relative_path);

let target_path = out_dir.join(Self::SRC).join(relative_path);

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants