Scaladoc 3 static site

I’ve been reading https://docs.scala-lang.org/scala3/guides/scaladoc/static-site.html and trying to use scaladoc to build a static site, without success. Anyone has a full working example, including sbt config? I’m having a hard time figuring out what file should go where, and what options are necessary (none of my markdown or html is being picked up).

3 Likes

Here is a simple example:

The index.md is placed on top in the docs folder,as configured in this part of the build.sbt:

Compile / doc / scalacOptions ++= Seq(
  "-groups",
  "-project-version", Version,
  "-project-footer", "Dep. of Computer Science, Lund University, Faculty of Engineering LTH",
  "-siteroot", ".",
  "-doc-root-content", "./docs/index.md",
  "-source-links:github://lunduniversity/introprog-scalalib/master",
  "-social-links:github::https://github.com/lunduniversity/introprog-scalalib"
)

The generated docs are here: http://cs.lth.se/pgk/api

HTH

4 Likes

Thanks.
Incidentally, what I’m creating is also a course support library (though more for me than for the students). I’m currently using the department’s web server as a repository, but I’d like to push it to GitHub or Maven at some point. I’ll probably need some help on that too…

I used your example as a starting point, and did a little more digging. Two sources of confusion for me were:

  • You use the same file for the root documentation of the API and and the root documentation outside the API. There’s no law against that, but one can also use two different files.
  • Contrary to what the scaladoc manual says, the default value for siteroot is ".", not "docs".

In the end, I wrote a small demo, with an sbt configuration and a few markdown files, that others might find useful as a starting point:

https://github.com/charpov/ScaladocStaticDemo

The output looks like this:

https://charpov.github.io/ScaladocStaticDemo

2 Likes

Thank’s for sharing! That’s really useful! I’ll take a look eventually how to update my stuff to perhaps be more as intended…