foundry icon indicating copy to clipboard operation
foundry copied to clipboard

bug: `forge doc` should only generate relative links

Open guidanoli opened this issue 6 months ago • 2 comments

Component

Forge

Have you ensured that all of these are up to date?

  • [X] Foundry
  • [X] Foundryup

What version of Foundry are you on?

forge 0.2.0 (26a7559 2024-07-31T00:18:10.296782444Z)

What command(s) is the bug in?

forge doc

Operating System

Linux

Describe the bug

Some links generated by forge doc are relative (like ../../../foo), and some are absolute (like /contracts/foo). When hosting documentation generated by forge doc on GitHub pages, the root is something like <user>.github.io/<repo>, and absolute links don't work because they don't have the <repo> part. Relative links works normally.

Steps to reproduce:

  • Clone cartesi/rollups-contracts
  • Run pnpm i to install all Node.js packages
  • Run forge doc -b to build documentation pages
  • Run grep -l '<a href="/' -r docs and you'll see there will be several pages with absolute links:
docs/book/contracts/dapp/SelfHostedApplicationFactory.sol/contract.SelfHostedApplicationFactory.html
docs/book/contracts/dapp/Application.sol/contract.Application.html
docs/book/contracts/dapp/ApplicationFactory.sol/contract.ApplicationFactory.html
docs/book/contracts/inputs/InputBox.sol/contract.InputBox.html
docs/book/contracts/consensus/authority/Authority.sol/contract.Authority.html
docs/book/contracts/consensus/authority/AuthorityFactory.sol/contract.AuthorityFactory.html
docs/book/contracts/consensus/AbstractConsensus.sol/abstract.AbstractConsensus.html
docs/book/contracts/consensus/index.html
docs/book/contracts/consensus/quorum/QuorumFactory.sol/contract.QuorumFactory.html
docs/book/contracts/consensus/quorum/Quorum.sol/contract.Quorum.html
docs/book/contracts/portals/Portal.sol/contract.Portal.html
docs/book/contracts/portals/IERC1155SinglePortal.sol/interface.IERC1155SinglePortal.html
docs/book/contracts/portals/ERC721Portal.sol/contract.ERC721Portal.html
docs/book/contracts/portals/IEtherPortal.sol/interface.IEtherPortal.html
docs/book/contracts/portals/IERC20Portal.sol/interface.IERC20Portal.html
docs/book/contracts/portals/ERC1155BatchPortal.sol/contract.ERC1155BatchPortal.html
docs/book/contracts/portals/IERC1155BatchPortal.sol/interface.IERC1155BatchPortal.html
docs/book/contracts/portals/ERC1155SinglePortal.sol/contract.ERC1155SinglePortal.html
docs/book/contracts/portals/IERC721Portal.sol/interface.IERC721Portal.html
docs/book/contracts/portals/EtherPortal.sol/contract.EtherPortal.html
docs/book/contracts/portals/ERC20Portal.sol/contract.ERC20Portal.html

guidanoli avatar Jul 31 '24 13:07 guidanoli