Beautify doesn't format HTML with Twig correctly
See original GitHub issue- Operating System (+Version): macOS 10.12.5
- VS Code Version: 1.14.1
- beautify Version: 1.1.1
Provide the settings you use: (VS Code workspace and user settings, .jsbeautifyrc, .editorconfig) eg.: VS Code:
"beautify.language": {
"html": {
"type": ["htm", "html", "twig"],
"ext": ["twig"]
}
},
.jsbeautifyrc
{
"html": {
"indent_with_tabs": false,
"max_preserve_newlines": 2,
"preserve_newlines": true,
"keep_array_indentation": true,
"break_chained_methods": true,
"wrap_line_length": 120,
"end_with_newline": true,
"brace_style": "collapse,preserve-inline",
"unformatted": ["a", "abbr", "area", "audio", "b", "bdi", "bdo", "br", "button", "canvas", "cite",
"code", "data",
"datalist", "del", "dfn", "em", "embed", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "map",
"mark", "math", "meter", "noscript", "object", "output", "progress", "q", "ruby", "s", "samp", "select", "small",
"span", "strong", "sub", "sup", "template", "textarea", "time", "u", "var", "video", "wbr", "text", "acronym",
"address", "big", "dt", "ins", "small", "strike", "tt", "pre", "h1", "h2", "h3", "h4", "h5", "h6"]
},
Action performed
Format javascript file with HookyQR.beautifyFile
command
Expected results
beautify is breaking the Twig code, it’s not formatted and indented correctly
Actual results
is there a way to ignore twig tags when formatting html documents including twig or a similar workaround? thanks a lot
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:13 (4 by maintainers)
Top Results From Across the Web
VS Code, format HTML code with Twig or Swig tags
To verify that everything's working properly, you can open the prettier terminal by clicking on Prettier at the bottom right in your VS...
Read more >Using Prettier with Twig in VS Code - CodeKnight
I've been formatting code by hand in VSCode for months because the twig auto-formatting was completely broken. Here's how I got it working ......
Read more >The First Prettier Plugin For Twig is Here - trivago tech blog
trivago open sourced a Prettier plugin for the Twig template language. It is available under the Apache 2.0 license, and you can access...
Read more >The flexible, fast, and secure template engine for PHP - Twig
When extending Twig without creating an extension, Twig won't be able to recompile your templates when the PHP code is updated. To see...
Read more >Code Formatting with Prettier in Visual Studio Code - YouTube
Formatting your code can be a hassle. Learn how to have your code automatically formatted to save yourself a lot of time and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
i solve it by add settings in jsbeautifyrc file:
Ugh… sorry @HookyQR, I cannot make it work, not even adding the
unformatted
option So sorry cause I know how much work you’ve done for the extension 😦