This plugin formats EJS markup in html files. It uses the default html parser and just marks EJS specific tags as comments.
npm install --save-dev prettier-plugin-ejsFor Prettier v2, the plugin will be loaded automatically.
For Prettier v3, you'll need to manually load the plugin:
prettier --plugin=prettier-plugin-ejs --write .Please check Prettier Docs for other loading methods.
<div>
<!-- prettier-ignore -->
<div>
<% if (condition) { %> <% } else if (condition) { %> <% } %>
</div>
<div class="<%= red %>"><%= 1 > 0 %></div>
<textarea><%= text %></textarea>
<code><%= text %></code>
<pre><%= text %></pre>
</div><div>
<div>
<% if (condition) { %>
<% } else if (condition) { %>
<% } %>
</div>
<div class="<%= red %>"><%= 1 > 0 %></div>
<textarea><%= text %></textarea>
<code><%= text %></code>
<pre><%= text %></pre>
</div><td <% if (styleData) { %>
style="<%= styleData %>" <% } %>>
<%= data %>
<%= data %>
</td>Tags which contains the greater then symbol > are ignored.