prettier-plugin-ejs 1.0.1 → 1.0.2
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 +10 -0
- package/index.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -55,6 +55,16 @@ Please check [Prettier Docs](https://prettier.io/docs/en/plugins.html) for other
|
|
|
55
55
|
</div>
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
+
## Nested Tag
|
|
59
|
+
|
|
60
|
+
```html
|
|
61
|
+
<td <% if (styleData) { %>
|
|
62
|
+
style="<%= styleData %>" <% } %>>
|
|
63
|
+
<%= data %>
|
|
64
|
+
<%= data %>
|
|
65
|
+
</td>
|
|
66
|
+
```
|
|
67
|
+
|
|
58
68
|
## Note
|
|
59
69
|
|
|
60
70
|
Tags which contains the greater then symbol `>` are ignored.
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) 1986-2023 Ecmel Ercan
|
|
2
|
+
* Copyright (c) 1986-2023 Ecmel Ercan (https://ecmel.dev/)
|
|
3
3
|
* Licensed under the MIT License
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ const { parsers } = require("prettier/parser-html");
|
|
|
7
7
|
|
|
8
8
|
function parse(text, options, legacy) {
|
|
9
9
|
const find =
|
|
10
|
-
/(?:<(textarea|title|script).*?<\/\1
|
|
10
|
+
/(?:<(textarea|title|script).*?<\/\1|<\s*[a-zA-Z!].*?[^%/]>|<%([^>]*)%>)/gs;
|
|
11
11
|
text = text.replace(find, (match, p1, p2) => (p2 ? `<!${p2}!>` : match));
|
|
12
12
|
return parsers.html.parse(text, options, legacy);
|
|
13
13
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier-plugin-ejs",
|
|
3
3
|
"displayName": "Prettier EJS Plugin",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"description": "A Prettier plugin for Embedded JavaScript Templating (EJS).",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"prettier",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"author": {
|
|
13
13
|
"name": "Ecmel Ercan",
|
|
14
|
-
"url": "https://
|
|
14
|
+
"url": "https://ecmel.dev/"
|
|
15
15
|
},
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|