作者:世界和平啊 | 来源:互联网 | 2023-09-18 11:15
IvebeeneditingalotofHTMLpageswithbasictexteditor,notepad.WhenIwenttovalidatethem
I've been editing a lot of HTML pages with basic text editor, notepad. When I went to validate them the validation service is saying theres a div
tag that is not closed. I tend to find automatic error reports such as these dont tend to be too reliable, i.e they will give you a line number and the error but often times the error is actually in another part of the file entirely.
我用基本的文本编辑器,记事本编辑了很多HTML页面。当我去验证它们时,验证服务说有一个没有关闭的div标签。我倾向于发现诸如此类的自动错误报告往往不太可靠。他们会给你一个行号和错误,但通常情况下错误实际上是整个文件的另一部分。
I'm just wondering if there are any free lightweight html editors that have the functionality of finding the closing tag for a tag. For example, you click on a tag then click a shortcut, and the program will jump to the closing tag, I know this functionality is in homesite, but i dont have homesite, and its a bit of a bulky program anyway.
我想知道是否有任何免费的轻量级html编辑器具有查找标记结束标记的功能。例如,你点击一个标签然后点击一个快捷键,程序就会跳转到结束标签,我知道这个功能在homesite中,但是我没有homesite,而且这个程序有点大。
Or even better any online html validation services that can highlight unclosed tags?
或者更好的是任何可以突出显示未关闭标记的在线html验证服务?
To sum up, I would like to know how to find html tags that don't have closing tags - is there a free html editor or simple online service that can help with this?
总之,我想知道如何找到没有结束标记的html标记——有免费的html编辑器或简单的在线服务可以帮助这一点吗?
8 个解决方案
0
free lightweight html editors ... online html validation services that can highlight unclosed tags?
免费的轻量级html编辑器…在线html验证服务可以高亮显示未关闭的标记?
Use linter-vnu.
使用linter-vnu。
linter-vnu is a package for the Atom editor that uses the Nu Html Checker (v.Nu) to validate HTML or XHTML documents.
lintervnu是一个Atom编辑器的包,它使用Nu Html Checker (vnu)来验证Html或XHTML文档。
Disclosure: I am the developer of linter-vnu.
披露:我是linter-vnu的开发者。
linter-vnu uses another Atom package, linter, to integrate v.Nu and Atom.
linter-vnu使用另一个Atom包linter来集成v。ν和原子。
For example, if you open the following test.html
file in Atom:
例如,如果您打开下面的测试。在原子html文件:
Lorem ipsum dolor sit amet...
(with a deliberately missing closing
tag)
(故意丢失关闭标签)
then Atom (or rather, linter-vnu, thanks to linter and v.Nu) displays the following error messages:
然后Atom(或者更确切地说是linter-vnu,多亏了linter和v.Nu)显示了以下错误消息:
- Unclosed element “div”. at line 8 col 1 in test.html
- 打开元素" div "。在test.html中的第8行
- End tag for “body” seen, but there were unclosed elements. at line 10 col 1 in test.html
- 看到“body”的结束标记,但是有未关闭的元素。在test.html中的第10行
and marks those lines in the editor with red dots.
在编辑器中用红点标记这些线。
If you click the "at..." (hyperlinked text) in the error message, the editor insertion point moves to the corresponding line, and a popup appears under the line, with the error text ('Unclosed element "div".').
如果你点击“at…”(超链接文本)在错误消息中,编辑器插入点移动到相应的行,并在一行中出现一个弹出框,其中有错误文本(“Unclosed element”div“。”)。
If you save your HTML document with the file extension .xhtml
, and open it in Atom, then v.Nu validates your document as XHTML (XML) rather than HTML, with slightly different messages. In this case, just one error message:
如果您使用文件扩展名.xhtml保存HTML文档,并在Atom中打开它,那么v。Nu将文档验证为XHTML (XML)而不是HTML,使用稍微不同的消息。在这种情况下,只有一条错误消息:
- required character (found “b”) (expected “d”) at line 10 col 3
- 要求的字符(找到“b”)(预期的“d”)在第3行
where line 10 contains the closing
tag. v.Nu was expecting a
tag instead; it was happy with
- it was expecting a closing tag - but it was expecting the element name to begin with "d" for "div", not "b" for "body".
其中第10行包含关闭的标记。v。Nu希望得到一个标签;它对
I make the following claims, as of November 2016:
从2016年11月开始,我提出以下主张:
- v.Nu is the best option for validating (X)HTML(5).
- v。Nu是验证(X)HTML(5)的最佳选择。
- linter-vnu is the best option for interactively harnessing v.Nu in an editor. linter-vnu itself is trivial; it's just a few lines of "glue" code. What makes it the best option is the Atom editor and the Atom linter package.
- linter-vnu是交互式利用v的最佳选择。ν在一个编辑器。linter-vnu本身是微不足道的;这只是几行“胶水”代码。使它成为最佳选项的是Atom编辑器和Atom linter包。
I welcome counterclaims and questions about these claims. I'd be happy to be proven wrong and be shown something better. Especially if, like v.Nu and linter-vnu, it's free.
我欢迎关于这些索赔的反诉和问题。我很高兴被证明是错误的,并且表现得更好。特别是,像v。Nu和lintervnu,它是免费的。