[英]HTML shows different DOCTYPE when opening with VIM
I have an HTML file with HTML 5 DOCTYPE.我有一个带有 HTML 5 DOCTYPE 的 HTML 文件。 When I open it with TextEdit or any other Mac tools, it shows correctly with HTML 5. However, when I open it using VIM through Terminal, the HTML file shows up completely different, with HTML 4 DOCTYPE.
当我使用 TextEdit 或任何其他 Mac 工具打开它时,它会以 HTML 5 正确显示。但是,当我通过终端使用 VIM 打开它时,HTML 文件显示的完全不同,使用 HTML 4 DOCTYPE。
Original HTML 5 code:原始 HTML 5 代码:
<!DOCTYPE html>
<html class="test" lang="bg">
<head>
<meta charset="utf-8">
<meta content="initial-scale=1, minimum-scale=1, width=device-width" name="viewport">
Weird code when opening with VIM:使用 VIM 打开时的奇怪代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="2113.4">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #440003; -webkit-text-stroke: #440003; background-color: #ffffff}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #440003; -webkit-text-stroke: #440003}
span.s1 {font-kerning: none}
span.Apple-tab-span {white-space:pre}
</style>
</head>
I can hardly believe they are the same file what here they are.我简直不敢相信它们是同一个文件。 What is the reason that made this change happen and what should I do to keep it as the original code everywhere?
发生这种变化的原因是什么,我应该怎么做才能将其作为原始代码保留在任何地方?
您看到添加的行来自使用 TextEdit 作为 html 文件的编辑器,通过简短的谷歌搜索,您可以找到有关它的信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.