在scaladoc中添加代码示例

时间:2015-08-31 18:26:58

标签: scala scaladoc

在ScalaDoc中添加代码示例的标准约定(或标记)是什么?在下面的代码中的示例中,我想提供编码示例来演示它的用法:

/**
 * 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]) = {

与javadocs一样,使用了@code

1 个答案:

答案 0 :(得分:12)

您可以使用{{{ }}} to delimit code blocks

/**
 * This is a comment.
 * 
 * {{{
 * this.is(example.code)
 * }}}
 */
 def is(some: Code): Unit