Skip to content

Commit 352d382

Browse files
committed
fixed issue 8
1 parent 8a95790 commit 352d382

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
const { parsers } = require("prettier/parser-html");
77

88
function parse(text, options, legacy) {
9-
const find = /(?:<(textarea|title|script).*?<\/\1|(["']).*?\2|<%([^>]*)%>)/gs;
10-
text = text.replace(find, (match, p1, p2, p3) => (p3 ? `<!${p3}!>` : match));
9+
const find =
10+
/(?:<(textarea|title|script).*?<\/\1|<[a-zA-Z!\s\\].*?(?<!%)>|<%([^>]*)%>)/gs;
11+
text = text.replace(find, (match, p1, p2) => (p2 ? `<!${p2}!>` : match));
1112
return parsers.html.parse(text, options, legacy);
1213
}
1314

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "prettier-plugin-ejs",
33
"displayName": "Prettier EJS Plugin",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"description": "A Prettier plugin for Embedded JavaScript Templating (EJS).",
66
"keywords": [
77
"prettier",

0 commit comments

Comments
 (0)