Javadoc Jsdoc 在 @param 和 @return 内容块之后写一些东西?
你知道是否可以在@param和@return块之后写一些东西。 假设我想在参数/返回声明之后编写一段文本,与它们分开。
看来 Javadoc 和 Jsdoc 都将您在 @param/@return 之后编写的任何内容附加到同一内容块中。
比方说,我希望文档显示如下:
function showUpperCaseString(string_to_show)
This function shows the input string in upper case and blah, blah, ...
Parameters:
{string} string_to_show
Returns:
{boolean} true if everything was ok, or false on failure
It's important to notice that I would like to show this text NOT in the
return contents. But the Javadoc, Jsdoc always attach everything to the last
@param/@return block. Even if I use nexline <br> or <p> it goes new line but
still indented as if it was part of the last return block.
Do you know if it's possible to write something after the @param and @return blocks.
Let's say I want to write a piece of text after the parameters/return declarations, something that is separated from them.
It seems Javadoc and Jsdoc both attach whatever you write after an @param/@return in the same block of conetnts.
Let's say for instance I want documentation to be shown like this:
function showUpperCaseString(string_to_show)
This function shows the input string in upper case and blah, blah, ...
Parameters:
{string} string_to_show
Returns:
{boolean} true if everything was ok, or false on failure
It's important to notice that I would like to show this text NOT in the
return contents. But the Javadoc, Jsdoc always attach everything to the last
@param/@return block. Even if I use nexline <br> or <p> it goes new line but
still indented as if it was part of the last return block.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于 JavaDoc 注释的格式,您尝试做的事情无法完成。 JavaDoc 确实允许一些 HTML,所以我之前通过添加我自己的“注释”区域来解决这个问题。
What you are trying to do can't be done due to the format of JavaDoc comments. JavaDoc does allow some HTML though so I have gotten around this previously by adding my own "notes" areas.
简短的回答,不,你不能这样做。
长答案,JavaDoc 的设计使得注释有两个部分:叙述自由形式部分和块部分。一旦开始使用任何块标签,它们仅由下一个块标签分隔。没有用于“结束”块部分的标记,因此无论您使用什么最终标记,直到注释末尾的文本都将与其关联。
也就是说,JavaDoc 标签的使用也有一个完善的约定,包括信息的排序。 (请参阅http://java.sun.com/j2se/javadoc/writingdoccomments/)。
我相信您能够实现您正在尝试的最接近的方法是使用 @see 标记链接到其中包含注释的 html 文件。
Short answer, No you can't do that.
Long answer, JavaDoc is designed such that a comment has two sections, the narraitve free form section, and the block section. Once you start using any of the block tags, they are only delimited by the next block tag. There is not a tag to 'end' the block section, so whatever the final tag you use, the text up to the end of the comment will be associated with it.
That said, there is also a well established convention for the usage of JavaDoc tags, including the ordering of the information. (see http://java.sun.com/j2se/javadoc/writingdoccomments/).
The closest that I believe you will be able to come to what you are attempting, is to use the @see tag to link to an html file with the notes in it.