File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
packages/website/src/scripts/playground Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,17 @@ export function toMarker(message) {
33
33
] ;
34
34
}
35
35
36
+ /**
37
+ * @param {string } str
38
+ * @returns {string }
39
+ */
40
+ export function escapeHTML ( str ) {
41
+ return str
42
+ . replace ( / & / g, "&" )
43
+ . replace ( / < / g, "<" )
44
+ . replace ( / > / g, ">" ) ;
45
+ }
46
+
36
47
export const INITIAL_HTML = html `<!DOCTYPE html>
37
48
< html >
38
49
< head >
Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ import "codemirror/mode/htmlmixed/htmlmixed.js";
3
3
import "codemirror/mode/javascript/javascript.js" ;
4
4
import CodeMirror from "codemirror" ;
5
5
import {
6
- toMarker
6
+ toMarker ,
7
+ escapeHTML
7
8
} from "./helpers" ;
8
9
import {
9
10
html
@@ -115,7 +116,7 @@ export class View {
115
116
}
116
117
117
118
return html `< li class ="bg-red-100 text-red-800 px-2 py-1 my-1 rounded ">
118
- ${ line } :${ column } - ${ message } (
119
+ ${ line } :${ column } - ${ escapeHTML ( message ) } (
119
120
< a href ="/docs/rules/ ${ ruleId . replace (
120
121
"@html-eslint/" ,
121
122
""
You can’t perform that action at this time.
0 commit comments