5

在 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

4

1 回答 1

15

您可以使用{{{ }}} 分隔代码块

/**
 * This is a comment.
 * 
 * {{{
 * this.is(example.code)
 * }}}
 */
 def is(some: Code): Unit
于 2015-08-31T18:31:22.510 回答