是否可以在RubyMine 3.2.4中格式化或重新加载html?我尝试了Code... Reformat Code
但它似乎没有为HTML做任何事情。我需要一个插件吗?
答案 0 :(得分:4)
确实有效。
使用生成的标准404.html文件:
<!DOCTYPE html>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<!-- This file lives in public/404.html -->
<div class="dialog">
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
</body>
</html>
我使用了Code / Reformat选项,结果如下:
<!DOCTYPE html>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<style type="text/css">
body {
background-color: #fff;
color: #666;
text-align: center;
font-family: arial, sans-serif;
}
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 {
font-size: 100%;
color: #f00;
line-height: 1.5em;
}
</style>
</head>
<body>
<!-- This file lives in public/404.html -->
<div class="dialog">
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
</body>
</html>
您可以看到它如何重新格式化样式(如果我更改换行符等,它也会修复它们。)
如果您转到文件/设置,IDE设置/编辑器,然后确保选中显示“重新格式化代码”选项对话框[x],再试一次。它可能被设置为仅修复选定的文本?或者......
答案 1 :(得分:2)
您可以使用⌘+⌥+ l作为键盘快捷键。
答案 2 :(得分:0)
您可以在&#34;项目设置&gt;上更改html格式选项。代码风格&gt; HTML&#34;
例如:您可以更改标签大小,缩进等。
如果您使用的是OSx,则可以使用快捷键⌘+,
其他建议:尝试在格式化之前重命名文件(从中删除.erb)