BUG: formatting ejs creates wrong code
See original GitHub issuePrettier 1.15.2 Playground link
--parser html
Input:
<html>
<input <% if(!flag){ %> disabled <%}%> />
</html>
Output:
<html>
<input <% if(!flag){ % />
disabled <%}%> />
</html>
Expected behavior:
when using prettier before it did not put any /
at the end of any >
symbol, but now it separates ‘%’ and ‘>’ (they together make ejs closing tag) puts slash before the >
symbol, so the ejs file fails to compile!
expected output should be something like this:
<html>
<input <% if(!flag){ %>
disabled <%}%> />
</html>
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
.ejs formatting in VSCode - Stack Overflow
I know that's an old question, but working with .ejs in VSCode is still a problem. But I found the solution (for ?...
Read more >Formatting EJS code with 2 spaces indent is not possible
I have an EJS template which I would like to auto-format using 2 spaces for indentation. I setup: File > Settings > Other...
Read more >EJS -- Embedded JavaScript templates
EJS is a simple templating language that lets you generate HTML markup with plain JavaScript. ... JavaScript code in simple, straightforward scriptlet tags....
Read more >Common Errors - RequireJS
This page lists errors that are generated by RequireJS. ... Likely causes and fixes: ... It is an error with the code logic...
Read more >Best Practices for Node.js Error-handling - Toptal
Developers working with Node.js sometimes find themselves writing not-so-clean code while handling all sorts of errors. This article will introduce you to ...
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 FreeTop 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
Top GitHub Comments
I think this is probably an VSCode issue since it’s not reproducible via CLI. Can you open an issue in
prettier-vscode
?We do not support ejs, and its syntax is conflict with HTML (the first
>
after<input
will be recognized asinput
’s opening tag end marker in HTML). I have a similar explanation that can also be applied here, see https://github.com/prettier/prettier/issues/5428#issuecomment-437412183.