Skip to content

Commit

Permalink
fixed issue 8
Browse files Browse the repository at this point in the history
  • Loading branch information
ecmel committed Jan 13, 2024
1 parent 8a95790 commit 352d382
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
const { parsers } = require("prettier/parser-html");

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

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "prettier-plugin-ejs",
"displayName": "Prettier EJS Plugin",
"version": "1.0.0",
"version": "1.0.1",
"description": "A Prettier plugin for Embedded JavaScript Templating (EJS).",
"keywords": [
"prettier",
Expand Down

0 comments on commit 352d382

Please sign in to comment.