Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding code examples in scaladoc

Tags:

scala

scaladoc

What is the standard convention (or tag) to add code examples in ScalaDoc? Example in the code below, I want to provide coding example to demonstrate it's usage:

/**
 * Adds a filter on DB Table Query if value is defined. Example:
 *
 * {code}
 * val startIncluded: Option[Timestamp] = _
 * tableQuery.filter(startIncluded)(startTime => _.start >= startTime)
 * {code}
 *
 * ... other doc ...
 */
def filter (value: Option[T])(condition: T => Table => Option[Boolean]) = {

Like in javadocs, @code is used.

like image 721
panther Avatar asked Aug 31 '15 18:08

panther


1 Answers

You can use {{{ }}} to delimit code blocks:

/**
 * This is a comment.
 * 
 * {{{
 * this.is(example.code)
 * }}}
 */
 def is(some: Code): Unit
like image 176
Sean Vieira Avatar answered Sep 24 '22 05:09

Sean Vieira