Html 是否可以向 Visual Studio 添加 HTML5 验证?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1084194/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is it possible to add HTML5 validation to Visual Studio?
提问by Rahul
I'm working on a page using <canvas>
, which is a HTML5 tag, in Visual Web Developer Express Edition 2008, and the validator in the HTML editor is telling me it's an invalid tag. That's because it's set to validate against XHTML 1.0 Transitional. I'd prefer for it to not do that and tell me what's valid or invalid based on the HTML5 doctype, but I can't find anywhere in the preferences that suggests this would be possible.
我正在使用<canvas>
Visual Web Developer Express Edition 2008 中的 HTML5 标记处理页面,HTML 编辑器中的验证器告诉我这是一个无效标记。那是因为它被设置为针对 XHTML 1.0 Transitional 进行验证。我希望它不要这样做,并根据 HTML5 文档类型告诉我什么是有效的或无效的,但是我在首选项中找不到任何表明这是可能的。
Is there a way to tell Visual Studio to validate against HTML5, or add a new spec reference manually? I'd prefer not to have to go in and add tags manually, which appears to be the only option at the moment.
有没有办法告诉 Visual Studio 针对 HTML5 进行验证,或者手动添加新的规范引用?我宁愿不必手动添加标签,这似乎是目前唯一的选择。
采纳答案by Rahul
It looks like the Visual Web Developer team solved the problem by adding HTML5 support themselves: http://blogs.msdn.com/webdevtools/archive/2009/11/18/html-5-intellisense-and-validation-schema-for-visual-studio-2008-and-visual-web-developer.aspx
看起来 Visual Web Developer 团队通过自己添加 HTML5 支持解决了这个问题:http: //blogs.msdn.com/webdevtools/archive/2009/11/18/html-5-intellisense-and-validation-schema-for -visual-studio-2008-and-visual-web-developer.aspx
You all probably know that new HTML 5 standard is coming. We made a new intellisense schema that you can add to VS 2008 or VWD Express 2008 and get intellisense and validation on HTML 5 elements.
大家可能都知道新的 HTML 5 标准即将到来。我们创建了一个新的智能感知架构,您可以将其添加到 VS 2008 或 VWD Express 2008 中,并在 HTML 5 元素上获得智能感知和验证。
回答by Eric Bock
For Visual Studio 2010 you'll want to install the Web Standards Update for Visual Studio 2010 SP1:
对于 Visual Studio 2010,您需要安装Visual Studio 2010 SP1的Web 标准更新:
It updates the HTML5 intellisense and validation to reflect the latest W3C specifications and fixes some bugs bugs in the current SP1 support for HTML5. Also JavaScript intellisense it updated to reflect many of the new browser capabilities such as Geolocation and DOM storage. Finally, this update adds comprehensive CSS3 intellisense and validation based on the latest specifications from W3C.
它更新了 HTML5 智能感知和验证以反映最新的 W3C 规范,并修复了当前 SP1 对 HTML5 支持中的一些错误。它还更新了 JavaScript 智能感知,以反映许多新的浏览器功能,例如地理定位和 DOM 存储。最后,此更新基于 W3C 的最新规范添加了全面的 CSS3 智能感知和验证。
For Visual Studio 2008, Microsoft has provided an updated version of the HTML 5 validation schema and intellisense in the Visual Studio Gallery.
对于 Visual Studio 2008,Microsoft 在 Visual Studio 库中提供了 HTML 5 验证架构和智能感知的更新版本。
The updated schema was posted by Mikhail Arkhipov, the same Microsoft employee who wrote the blog post linked in Rahul's answer.
更新后的架构由 Mikhail Arkhipov 发布,Mikhail Arkhipov 是撰写Rahul 回答中链接的博客文章的同一位 Microsoft 员工。
回答by John Dyer
I created a validation schema that you're free to use: http://johndyer.name/post/2009/07/21/HTML5-XHTML5-Validation-Schema-for-Visual-Studio-2008.aspx
我创建了一个您可以免费使用的验证架构:http: //johndyer.name/post/2009/07/21/HTML5-XHTML5-Validation-Schema-for-Visual-Studio-2008.aspx
回答by jnoreiga
This is now included in Visual Studio 2010 SP1
这现在包含在Visual Studio 2010 SP1 中
回答by Richard
You can define your own validation standards.
您可以定义自己的验证标准。
You need to add the file to the folder in VS install, and add to the registry.
您需要将文件添加到VS安装的文件夹中,并添加到注册表中。
This is the description I used (HTML and CSS have a very similar approach): http://blogs.msdn.com/mikhailarkhipov/archive/2007/10/19/how-to-create-custom-css-intellisense-schema-in-visual-studio-2005-and-2008.aspx
这是我使用的描述(HTML 和 CSS 有非常相似的方法):http: //blogs.msdn.com/mikhailarkhipov/archive/2007/10/19/how-to-create-custom-css-intellisense-schema -in-visual-studio-2005-and-2008.aspx