问题描述
Checkstyle规则不允许标签< u>
。根据文档,这些检查是在Sun的DocCheck doclet进行的检查之后进行的。不幸的是,我在任何地方都找不到DocCheck。我也没有在Javadoc中找到有关允许的HTML标签的任何官方文档。
The Checkstyle rule JavadocStyle does not allow the tag <u>
. According to the docs, the checks were patterned after the checks made by the DocCheck doclet available from Sun. Unfortunately, I have not found DocCheck anywhere. Neither have I found any official documentation about allowed HTML tags in Javadoc. Is there any?
推荐答案
从Java 8开始,Javadoc只允许一部分HTML标签。
Javadoc permits only a subset of HTML tags, as of Java 8.
Javadoc的doclint组件强制执行此限制。
您可以通过将 -Xdoclint:none
传递给javadoc来禁用所有doclint警告,
则应考虑修复Javadoc注释,因为否则会生成HTML API文档可能看起来很糟,或者可能省略内容。 (我通常使用
-Xdoclint:all,-missing
来获取有关除缺少Javadoc @
以外的所有内容的警告标签。)
Javadoc's doclint component enforces this restriction.You can disable all doclint warnings by passing -Xdoclint:none
to javadoc,though you should consider fixing your Javadoc comments because otherwise the generated HTML API documentation may look bad or may omit content. (I usually use-Xdoclint:all,-missing
to get warnings about everything except missing Javadoc @
tags.)
我没有找到doclint允许的标签的公共文档,但这是其允许的HTML标签的列表,我从Java 8的文件中收集到这些 langtools / src / share / classes / com / sun / tools / doclint / HtmlTag.java
。
I have not found public documentation of the tags that doclint permits, but here is a list of its allowed HTML tags, which I gleaned from Java 8's file langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java
.
A
B
BIG
BLOCKQUOTE
BODY
BR
CAPTION
CENTER
CITE
CODE
DD
DFN
DIV
DL
DT
EM
FONT
FRAME
FRAMESET
H1
H2
H3
H4
H5
H6
HEAD
HR
HTML
I
IMG
LI
LINK
MENU
META
NOFRAMES
NOSCRIPT
OL
P
PRE
SCRIPT
SMALL
SPAN
STRONG
SUB
SUP
TABLE
TBODY
TD
TFOOT
TH
THEAD
TITLE
TR
TT
U
UL
VAR
更新J DK 9
JDK 9允许使用与JDK 8不同的一组标签。这是两个JDK的标签的列表,并附有仅由一个JDK允许的标签的注释。同样,数据来自 HTMLTag.java
文件。
JDK 9 permits a different set of tags than JDK 8 does. Here is a list of tags for both JDKs, with notes about those permitted by only one of the JDKs. Again, the data comes from the HTMLTag.java
file.
A
BIG // JDK 8 only
B // JDK 8 only
BLOCKQUOTE
BODY
BR
CAPTION
CENTER
CITE // JDK 8 only
CODE
DD
DFN // JDK 8 only
DIR // JDK 9 only
DIV
DL
DT
EM
FONT
FOOTER // JDK 9 only
FRAME // JDK 8 only
FRAMESET // JDK 8 only
H1
H2
H3
H4
H5
H6
HEAD
HEADER // JDK 9 only
HR
HTML
I
IFRAME // JDK 9 only
IMG
INPUT // JDK 9 only
LI
LINK
LISTING // JDK 9 only
MAIN // JDK 9 only
MENU
META
NAV // JDK 9 only
NOFRAMES // JDK 8 only
NOSCRIPT
OL
P
PRE
SCRIPT
SECTION // JDK 9 only
SMALL
SPAN
STRONG
SUB
SUP // JDK 8 only
TABLE
TBODY
TD
TFOOT // JDK 8 only
TH
THEAD // JDK 8 only
TITLE
TR
TT
U // JDK 8 only
UL
VAR // JDK 8 only
这篇关于Javadoc中允许的HTML标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!