vim - How to check if a label is closed?
ringa_lee
ringa_lee 2017-06-19 09:07:53
0
2
1376

I edited an html document today. I just started editing it and the test passed.
Later, I made some modifications to the header, and found out that something was wrong. After opening it with a browser, nothing was displayed.

After searching for a long time, I finally found the problem: the js tag added in the head is not closed.

<head>
    <meta charset="UTF-8">
    <title></title>
    <script text="text/javascript" src="test.js">
</head>

将script闭合后,问题解决。
<head>
    <meta charset="UTF-8">
    <title></title>
    <script text="text/javascript" src="test.js"></script>
</head>    

On this small mistake, I spent an hour and forgot to add the js tag in the head.
Excuse me, is there a good way to quickly check this problem?
I installed matchit.zip and found that if you don’t know which tag has a problem, this plug-in cannot automatically check it for you.

I installed syntastic. How do I enable the checking function after installing tidy?

ringa_lee
ringa_lee

ringa_lee

reply all(2)
刘奇

The simple way is that your IDE will check it for you. If your IDE cannot help you do this, there are some plug-ins that check for syntax errors. However, different IDEs have different support for plug-ins and require different plug-in packages. Sublime is the best in this regard. Vim can also be used, but if you are not familiar with it, it is not recommended to use it. The last way is to write one yourself using a program. The simple way in a package can be implemented using the stack. The more complex way is to use some libraries for syntax checking, flex, etc.

ringa_lee

Maintaining a consistent code style can effectively avoid this problem. There are many HTML checking tools, such as https://github.com/yaniswang/..., and eslint is also very good for js http://cn.eslint .org/

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template