I binged or googled for scaladoc 2.0 tutorial or example, I could not find anything, in fact not even a link to official scaladoc 2.0 documentation. Anyone know where to find one?
docs.scala-lang.org is a more recent source of "Community-driven documentation for Scala" (thanks to the initiative lead by Heather Miller).
(as edited by Martin Konicek in David James's original answer)
The Scaladoc page is quite up-to-date.
Martin Konicek asks in the comment how to make a simple Javadoc-like {@link}
.
(And {@link}
isn't mentioned in scala.tools.nsc.ast.DocComments.scala
)
He mentions that Scaladoc uses [[fullyQualifiedName]]
instead of {@link}
.
Initial answer (July/Sept 2011)
Right now, the most complete source of information I know about Scaladoc2 is in the new scala-lang.org Wiki.
David James mentions in the comments the Syntax page, and the Tags and Annotations.
The author page has examples, including a what's new section:
Authors of documentation no longer have to use HTML tags in their comments.
Instead, Scaladoc supports a wiki-like syntax very similar to that used in Trac.
In general, Scaladoc authors should no longer use HTML tags in documentation as Scaladoc may in the future also generate documentation in other formats than HTML.
@link
. –
Tabulator {@link}
–
Tabulator I wrote a Scaladoc HOWTO over on github here.
It's a how-to written with Scaladoc itself so it serves as an example. I placed extra emphasis on how to get the package documentation to show up in your API, as this is not very clear in the official documentation.
/*#! scaladoc */
in your source. Is this important? –
Childress The Scala Style Guide has a nice introductory page on scaladoc. I'd recommend it over the scala-lang.org wiki mentioned in @VonC's answer.
A condensed full example:
/** Creates [[mypackage.Person]] instances, taking a `String` argument. */
object Person {
/** Create a [[mypackage.Person]] with a given name.
*
* This is another paragraph (note the empty line above) containing '''bold''',
* ''italic'', `monospace`, __underline__, ^superscript^, and ,,subscript,,.
*
* Example:
* {{{
* val person = Person("Bill")
* }}}
*
* @param name their name
* @return a new Person instance
*/
def apply(name: String) = {}
}
Note that Scaladoc 2.9 does not support [[links]] to methods (like Javadoc's {@link type#instanceMethod(int, String)}
or {@link type.staticMethod()}
).
This is the best Scaladoc guide I have found: https://gist.github.com/VladUreche/8396624. It is markdown text, so download it and use a markdown viewer plugin for your browser or paste it into http://markdownlivepreview.com/ to read it.
© 2022 - 2024 — McMap. All rights reserved.