Description
Every page generated by Scaladoc (for package, class, object etc...) contains menu on the left, which contains link to every other page. As a result, Scaladoc output size grows quadratically with number of input files.
In case of scala 3 api documentation, with menu it weights ~730MB, without menu less than 200MB. Although this 0.5GB overhead may by acceptable in this case, it gets worse:
Recently tested on 10k+ classes (all rather simple): Scaladoc after about 38 minutes consumed over 140GB of disk space and crashed with java.io.IOException: No space left on device
. Without menu it generates ~300MB.
I outline 2 proposed solutions below. They both could be hidden behind a flag, so they would be opt-in.
-
Solution not involving javascript -
iframe
The menu could be generated once into a file, egsidemenu.html
. This file could be then included in iframe on every page.
To make the links inside iframe work, we would include<base target="_parent">
insidemenu.html
Highlighting current item in menu could be done with a little bit of css and target at the end of iframe url.
This would probably look a little worse than 2nd solution. -
Solution involving javascript
Serialize menu structure into a file, egsidemenu.json
, load it with JS and render. Links and highlighting work as before.
Since this would be opt-in, I'm leaning towards second solution.