我正在开发一个Laravel项目并使用Blade进行模板化。我的问题是Sublime在保存文件时将每个HTML标记放在下一行。保存的Autoformat已启用。这是一个例子:
<select class="form-control" name="data[month_number]">
<option value="1">
January
</option>
<option value="2">
February
</option>
<option value="3">
March
</option>
<option value="4">
April
</option>
<option value="5">
May
</option>
<option value="6">
June
</option>
<option value="7">
July
</option>
<option value="8">
August
</option>
<option value="9">
September
</option>
<option value="10">
October
</option>
<option value="11">
November
</option>
<option value="12">
December
</option>
</select>
应该是:
<select class="form-control" name="data[month_number]">
<option value="1">January</option>
<option value="2">February</option>
....
</select>
这是我的HTML CodeFormatter设置:
"codeformatter_html_options": {
"syntaxes": "html,blade,asp,xml,php", // Syntax names which must process HTML formatter
"format_on_save": true, // Format on save. Either a boolean (true/false) or a string regexp tested on filename. Example : "^((?!.min.|vendor).)*$"
"formatter_version": "bs4", // Which formatter to use. Current options are "bs4" and "regexp". If an error occurs while loading the bs4 formatter, the regexp formatter will automatically be used
"indent_size": 4, // indentation size
"indent_char": " ", // Indentation character
"indent_with_tabs": false, // Indent with one tab (overrides indent_size and indent_char options)
"exception_on_tag_mismatch": false, // If the last closing tag is not at the same indentation level as the first opening tag, there's probably a tag mismatch in the file
"expand_javascript": false, // (Under construction) Expand JavaScript inside of <script> tags (also affects CSS purely by coincidence)
"expand_tags": false, // Expand tag attributes onto new lines
"minimum_attribute_count": 2, // Minimum number of attributes needed before tag attributes are expanded to new lines
"first_attribute_on_new_line": false, // Put all attributes on separate lines from the tag (only uses 1 indentation unit as opposed to lining all attributes up with the first)
"preserve_newlines": true, // whether existing line breaks should be preserved,
"max_preserve_newlines": 2, // maximum number of line breaks to be preserved in one chunk
"reduce_empty_tags": false, // Put closing tags on same line as opening tag if there is no content between them
"reduce_whole_word_tags": false, // Put closing tags on same line as opening tag if there is whole word between them
"custom_singletons": "" // Custom singleton tags for various template languages outside of the HTML5 spec
},
答案 0 :(得分:0)
使用reduce_whole_word_tags
选项:
"reduce_whole_word_tags": false, // Put closing tags on same line as opening tag if there is whole word between them
您将其设置为false
。将其设置为true
。