diff --git a/edit.js b/edit.js index 6f6dc026..7b2c086c 100644 --- a/edit.js +++ b/edit.js @@ -859,13 +859,17 @@ function updateLintReport(cm, delay) { delete oldMarkers[pos]; } newMarkers[pos] = info.message; + var message = escapeHtml(info.message.replace(/ at line \d.+$/, "")); + if (message.length > 100) { + message = message.substr(0, 100) + "..."; + } return "" + "" + info.severity + "" + "" + (info.from.line+1) + "" + ":" + "" + (info.from.ch+1) + "" + - "" + info.message.replace(/ at line \d.+$/, "") + ""; + "" + message + ""; }).join("") + ""; cm.state.lint.markedLast = newMarkers; fixedOldIssues |= Object.keys(oldMarkers).length > 0; @@ -885,6 +889,10 @@ function updateLintReport(cm, delay) { } } } + function escapeHtml(html) { + var chars = {"&": "&", "<": "<", ">": ">", '"': '"', "'": ''', "/": '/'}; + return html.replace(/[&<>"'\/]/g, function(char) { return chars[char] }); + } } function renderLintReport(blockChanged) {