在 scaladoc 中添加代码示例

Adding code examples in 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

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

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