我在Windows上使用js-beautify 1.6.4从Atom文本编辑器包中格式化一些HTML。
这是HTML:
<html>
<head>
<meta charset="utf-8">
<title></title>
<style media="screen">
p {
color: #444;
}
</style>
</head>
<body>
<p>Some paragraph written in a WYSIWYG editor</p>
<h1>HEADER written in a WYSIWYG editor</h1>
</body>
</html>
以下是我传入美化的选项:
{
end_with_newline: false,
eol: "\n",
extra_liners: [],
indent_inner_html: true,
indent_size: 2,
preserve_newlines: true,
wrap_attributes_indent_size: 1,
wrap_line_length: 80
}
这是我得到的HTML输出:
<html>
<head>
<meta charset="utf-8">
<title></title>
<style media="screen">
p {
color: #444;
}
</style>
</head>
<body>
<p>Some paragraph written in a WYSIWYG editor</p>
<h1>HEADER written in a WYSIWYG editor</h1>
</body>
</html>
我不明白为什么要添加两个额外的空白行。有没有我错过或误解的选择,或者我应该做的另一种方式?