Help:Lint errors/misnested-tag/zh

The misnested tag warning is triggered when some tag or wikitext markup is closed outside of its parent and those tags or marks are overlapped. This linter category has been added to assist editors in fixing wikitext and templates that have instances of misnested tags. Linter will flag a warning for all the examples below. We are treating this as a warning currently.

範例1：

範例2：

範例3：

範例4：

範例5：

範例6：

In Examples 1 and 2, the tag (either in HTML or wikitext form) should be properly nested inside the  tag. While the parsers fix this up right now, the output may not always be what the editors intended.

In Example 3, the tag should be closed and reopened on lines 2 and 3.

In Example 4, HTML5 semantics require the tag (and other formatting tags like, etc.) to be wrapped around individual elements. To fix this problem, use a tag to wrap lists. For common usages such as the small tag, templates such as Template:Smalldiv on English Wikipedia can make such replacements easier.

In Example 5, much like previous examples, the output is invalid because that wikitext would expand to. The pair should be either inside or outside the span, e.g..

In Example 6, a span tag is wrapped around a line break. Possible resolutions are to remove the manual line break (using a br tag if desired) or wrap each line in its own span tags.

工具
The following tools can help fix misnested tags:

Misnested tags may be reported by WPCleaner as part of CheckWiki error #539.
 * WPCleaner: see instructions on how to use WPCleaner for fixing errors detected by Linter.

参见

 * HTML5中未嵌套標籤的規範
 * HTML5中未嵌套標籤的規範