Skip to content
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

Scaladoc generates broken local links #19208

Open
dixine55 opened this issue Dec 5, 2023 · 5 comments
Open

Scaladoc generates broken local links #19208

dixine55 opened this issue Dec 5, 2023 · 5 comments

Comments

@dixine55
Copy link

dixine55 commented Dec 5, 2023

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.

@dixine55 dixine55 added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Dec 5, 2023
@som-snytt
Copy link
Contributor

how scalaDoc works

Someone will say "Scaladoc", so it might as well be me. I don't know why it departs from "JavaDoc".

I don't know why an option would be needed, in the sense that URLs should just work. Scaladoc tool is always unexpectedly complex. I would expect the complexity at runtime, to support its useful features.

@dixine55
Copy link
Author

dixine55 commented Dec 5, 2023

@som-snytt Thank you for pointing out that inconsistency, fixed it now!

I agree that it'd be good if it worked straight out of the box, but as I haven't really developed a good enough understanding of how the code interacts in the grand scheme of things I was suggesting the "-local" option in case there is no "two world"-solution where it works both for local and online deployment right away.

I assume that the majority who use the tool will end up uploading it online anyway and therefore wouldn't want to tweak around too much with it, but then again, there's also cases where you want to try building it locally first..

@bjornregnell
Copy link
Contributor

bjornregnell commented Dec 6, 2023

I think it should "Just work" out of the box for both local and server deployment, if possible, without any configs etc. If configs are needed it should work out of the box with no config for local usage and then require setting/config for server deployment. This is best because local usage is the simplest use case for beginners.

@bjornregnell
Copy link
Contributor

bjornregnell commented Dec 6, 2023

BTW: Many thanks @dixine55 for fixing a simple-to-use workaround. This will help many students of Scala!

@SethTisue
Copy link
Member

SethTisue commented Dec 6, 2023

seems related? #18903

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

No branches or pull requests

5 participants