Skip to content

Commit

Permalink
Markup: Fixed quotes in HTML attribute values (#3442)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Apr 29, 2022
1 parent 0d4b6cb commit ca8eaee
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 7 deletions.
5 changes: 4 additions & 1 deletion components/prism-markup.js
Expand Up @@ -51,7 +51,10 @@ Prism.languages.markup = {
pattern: /^=/,
alias: 'attr-equals'
},
/"|'/
{
pattern: /^(\s*)["']|["']$/,
lookbehind: true
}
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion components/prism-markup.min.js

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

5 changes: 4 additions & 1 deletion prism.js
Expand Up @@ -1325,7 +1325,10 @@ Prism.languages.markup = {
pattern: /^=/,
alias: 'attr-equals'
},
/"|'/
{
pattern: /^(\s*)["']|["']$/,
lookbehind: true
}
]
}
},
Expand Down
5 changes: 1 addition & 4 deletions tests/languages/markup!+javascript/javascript_inclusion.test
Expand Up @@ -143,10 +143,7 @@ let foo = '</script>';
["attr-value", [
["punctuation", "="],
["punctuation", "\""],
"this.textContent=",
["punctuation", "'"],
"Over!",
["punctuation", "'"],
"this.textContent='Over!'",
["punctuation", "\""]
]],
["punctuation", ">"]
Expand Down
27 changes: 27 additions & 0 deletions tests/languages/markup/issue3441.test
@@ -0,0 +1,27 @@
<google-chart data='[["Month", "Days"], ["Jan", 31]]'></google-chart>

----------------------------------------------------

[
["tag", [
["tag", [
["punctuation", "<"],
"google-chart"
]],
["attr-name", ["data"]],
["attr-value", [
["punctuation", "="],
["punctuation", "'"],
"[[\"Month\", \"Days\"], [\"Jan\", 31]]",
["punctuation", "'"]
]],
["punctuation", ">"]
]],
["tag", [
["tag", [
["punctuation", "</"],
"google-chart"
]],
["punctuation", ">"]
]]
]

0 comments on commit ca8eaee

Please sign in to comment.