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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added strip_prefixback there.

@grandizzy grandizzy self-requested a review November 5, 2025 22:05
Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@grandizzy grandizzy enabled auto-merge November 5, 2025 22:05
@grandizzy grandizzy added this pull request to the merge queue Nov 5, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 5, 2025
@grandizzy grandizzy added this pull request to the merge queue Nov 5, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 5, 2025
@grandizzy grandizzy merged commit 118e12e into foundry-rs:master Nov 5, 2025
39 of 43 checks passed
@github-project-automation github-project-automation bot moved this to Done in Foundry Nov 5, 2025
DaniPopes added a commit that referenced this pull request Nov 6, 2025
@DaniPopes
Copy link
Member

This doesn't pass Windows tests: https://github.com/foundry-rs/foundry/actions/runs/19144190665/job/54717330057#step:14:1252

Reverting in #12373

Same as #12026 (comment)

Please don't force merge PRs anymore

grandizzy pushed a commit that referenced this pull request Nov 6, 2025
Revert "fix(forge doc): use relative path instead of full path (#12373)"

This reverts commit 118e12e.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants