首页 > Sublime3 用Sublime-HTMLPrettify 不能格式化混编代码吗?

Sublime3 用Sublime-HTMLPrettify 不能格式化混编代码吗?

请问在Sublime Text3 中用 Sublime-HTMLPrettify 不能格式化HTML中含PHP的混编代码吗?是我配置问题还是本身就不支持?

图中源码为Wecenter,仅演示!
格式化前

格式化后

问题表现为 <?php } ?>闭合没有对齐!!!

现在的设置如下

"html": {
    "allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg"],
    "brace_style": "collapse", // [collapse|expand|end-expand|none] Put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line, or attempt to keep them where they are
    "end_with_newline": false, // End output with newline
    "indent_char": " ", // Indentation character
    "indent_handlebars": false, // e.g. {{#foo}}, {{/foo}} 
    "indent_inner_html": false, // Indent <head> and <body> sections 
    "indent_scripts": "keep", //[keep|separate|normal]
    "indent_size": 2, // Indentation size 
    "max_preserve_newlines": 0, // Maximum number of line breaks to be preserved in one chunk (0 disables) 
    "preserve_newlines": true, // Whether existing line breaks before elements should be preserved (only works before elements, not inside tags or for text) 
    "unformatted": ["a", "span", "img", "code", "pre", "sub", "sup", "em", "strong", "b", "i", "u", "strike", "big", "small", "pre", "h1", "h2", "h3", "h4", "h5", "h6", "li"], // List of tags that should not be reformatted 
    "wrap_line_length": 0 // Lines should wrap at next opportunity after this number of characters (0 disables) 
  },

这个问题在javasript-beautify
已经被解决了 请查阅issue

所以可以安装 javasript-beautify来使用

【热门文章】
【热门文章】