Skip to content

Scaladoc generates broken local links #19208

Closed
@dixine55

Description

@dixine55

As of currently, when you generate documentation for your library, the links that are generated are not clickable locally.
I believe that this is due to that the network request made by jQuery is denied because of a CORS error, which is seen in the network tab.
error

Compiler version

sbt:> print scalaVersion
3.3.0

Minimized code

scala-cli doc .
sbt doc

Both generations will lead to broken local links, I have not been able to generate it and try with Scaladoc directly, no matter what I've attempted as an arg to Scaladoc I get "The system cannot find the path specified.", but since both scala-cli and sbt doc are based on Scaladoc I feel pretty confident it's an issue with Scaladoc itself.

Output

Directory with
packageName/
fonts/
hljs/
images/
scripts/
styles/
webfonts/
packageName.html
favicon.ico
index.html
scaladoc.version (3.3.0)

And when you open packageName.html or index.html or any of the html files in packageName/* the linking doesn't work.

Expectation

I believe it should work out of the box, or it feels really weird for it not to..

But, in order to fix it I made this code that does almost patch all the links perfectly, I tried to understand how Scaladoc works by itself, but it's over my paygrade.

So if it is a bug and/or if we could add it as a feature to build it locally by passing an argument -local, that'd be very helpful to people that don't know how to boot up a webserver and configure headers.

Link to the program that fixes the links:
https://github.com/dixine55/Scaladoc-Local-Version-Patcher

Edit; As som-snytt pointed out I missspelled Scaladoc as scalaDoc, changed it so it's consistent.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions