@example¶
-
.. @example::
¶ - 语法
@example
- 概述
提供如何使用记录的项目的示例. 此标记后面的文本将显示为突出显示的代码.
- 示例
请注意, doclet可能有多个示例.
Documenting examples¶/** * Solves equations of the form a * x = b * @example * // returns 2 * globalNS.method1(5, 10); * @example * // returns 3 * globalNS.method(5, 15); * @returns {Number} Returns the value of x for the equation. */ globalNS.method1 = function (a, b) { return b / a; };
在@example标记之后, 也可以使用``<caption> </ caption>``来标注示例.
Documenting examples with a caption¶/** * Solves equations of the form a * x = b * @example <caption>Example usage of method1.</caption> * // returns 2 * globalNS.method1(5, 10); * @returns {Number} Returns the value of x for the equation. */ globalNS.method1 = function (a, b) { return b / a; };