INNER CODE UNIT · JavaScript
onViolationClick
DavidAnson/markdownlint · demo/default.js:210
function onViolationClick(e) {
const resultJson = JSON.parse(decodeURIComponent(e.target.target));
switch (e.target.hash) {
case "#fix":
var errors = e.shiftKey ?
allLintErrors :
[ resultJson ];
var fixed = markdownlint.applyFixes(markdown.value, errors);
markdown.value = fixed;
onMarkdownInput();
e.preventDefault();
break;
case "#line":
// eslint-disable-next-line unicorn/no-useless-spread
for (const element of [ ...document.getElementsByClassName("highlight") ]) {
element.classList.remove("highlight");
}
highlightRanges([ resultJson ], "highlight");