我刚被一个虫子咬了
<link rel=stylesheet" type="text/css" href="stylesheet.css" media="all">
而不是
<link rel="stylesheet" type="text/css" href="stylesheet.css" media="all">
似乎 vim 的 html 语法突出显示并没有区分两者。我可以从某个地方获得更严格的语法文件吗?
我刚被一个虫子咬了
<link rel=stylesheet" type="text/css" href="stylesheet.css" media="all">
而不是
<link rel="stylesheet" type="text/css" href="stylesheet.css" media="all">
似乎 vim 的 html 语法突出显示并没有区分两者。我可以从某个地方获得更严格的语法文件吗?
作为权宜之计,我放了一份$VIMRUNTIME/syntax/html.vim
in~/.vim/syntax/html.vim
并对其进行了修改:
38c38
< syn match htmlValue contained "=[\t ]*[^'" \t>][^ \t>]*"hs=s+1 contains=javaScriptExpression,@htmlPreproc
---
> syn match htmlValue contained /=[\t ]*\%('\%(\\.\|[^\\']\)*'\|"\%(\\.\|[^\\"]\)*\|[^'" \t>]*\)/hs=s+1 contains=htmlString,javaScriptExpression,@htmlPreproc
40c40
< syn region htmlTag start=+<[^/]+ end=+>+ contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster
---
> syn region htmlTag start=+<[^/]+ end=+>+ contains=htmlTagN,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster
43a44
> syn match htmlTagError contained /['"].*/
168c169
< syn region htmlScriptTag contained start=+<script+ end=+>+ contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent
---
> syn region htmlScriptTag contained start=+<script+ end=+>+ contains=htmlTagN,htmlArg,htmlValue,htmlTagError,htmlEvent
这只是捕获了这个特定的错误(不匹配的引号),所以我仍然对严格 html 的更好语法文件非常感兴趣。