prettier-plugin-ejs 0.0.19 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -15
- package/index.js +9 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,16 +29,9 @@ Please check [Prettier Docs](https://prettier.io/docs/en/plugins.html) for other
|
|
|
29
29
|
<% if (condition) { %> <% } else if (condition) { %> <% } %>
|
|
30
30
|
</div>
|
|
31
31
|
|
|
32
|
-
<!-- prettier-ignore -->
|
|
33
|
-
<div>
|
|
34
|
-
<%
|
|
35
|
-
const a = 0;
|
|
36
|
-
%>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
32
|
<div class="<%= red %>"><%= 1 > 0 %></div>
|
|
40
33
|
|
|
41
|
-
<textarea
|
|
34
|
+
<textarea><%= text %></textarea>
|
|
42
35
|
<code><%= text %></code>
|
|
43
36
|
<pre><%= text %></pre>
|
|
44
37
|
</div>
|
|
@@ -54,15 +47,9 @@ Please check [Prettier Docs](https://prettier.io/docs/en/plugins.html) for other
|
|
|
54
47
|
<% } %>
|
|
55
48
|
</div>
|
|
56
49
|
|
|
57
|
-
<div>
|
|
58
|
-
<%
|
|
59
|
-
const a = 0;
|
|
60
|
-
%>
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
50
|
<div class="<%= red %>"><%= 1 > 0 %></div>
|
|
64
51
|
|
|
65
|
-
<textarea
|
|
52
|
+
<textarea><%= text %></textarea>
|
|
66
53
|
<code><%= text %></code>
|
|
67
54
|
<pre><%= text %></pre>
|
|
68
55
|
</div>
|
package/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 1986-2023 Ecmel Ercan <ecmel.ercan@gmail.com>
|
|
3
|
+
* Licensed under the MIT License
|
|
4
|
+
*/
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const { parsers } = require("prettier/parser-html");
|
|
7
7
|
|
|
8
8
|
function parse(text, options, legacy) {
|
|
9
|
-
|
|
9
|
+
const find =
|
|
10
|
+
/(?:<(textarea|title|script).*?<\/\1|<[a-zA-Z!\s\\].*?(?<!%)>|<%([^>]*)%>)/gs;
|
|
11
|
+
text = text.replace(find, (match, p1, p2) => (p2 ? `<!${p2}!>` : match));
|
|
12
|
+
return parsers.html.parse(text, options, legacy);
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
module.exports = {
|