I cannot add a package description in ScalaDoc with Scala 3
/** package description */
package foo {
/** some scaladoc comment */
def method():A = ???
}
Then I generate the doc with sbt (1.5.3)
sbt> doc
I don't get the description of the package itself in the index.html
file, but only the description of the method
inside the package.
Package in Scala is a mechanism to encapsulate a group of classes, sub packages, traits and package objects. It basically provides namespace to put our code in a different files and directories. Packages is a easy way to maintain our code which prevents naming conflicts of members of different packages.
Scaladoc is a documentation generation system that reads specially formatted comments in Scala source code and generates compiled documentation. It is similar to Javadoc in Java. In this tutorial, we’ll learn how to add Scaladoc to code for a Scala project.
You can mark up your source code using Scaladoc tags as well as a wiki-like syntax. The following code shows many of the Scaladoc tags and a few of the wiki-style markup tags: package co.kbhr.scaladoc_tags /** * A class to represent a ''human being''.
In Scala you can import one member from a package like this: and multiple members like this: When importing multiple members, you can import them more concisely like this: When you want to import everything from the scala.concurrent package, use this syntax: import scala.concurrent.*
I finally found the answer
Scaladoc comments can go before fields, methods, classes, traits, objects. For now, scaladoc doesn't support straightforward solution to document packages. There is a dedicated github issue, where you can check the current status of the problem.
https://github.com/lampepfl/dotty/issues/11284
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With