mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
wip
Some checks failed
Checkers / linkcheck (push) Has been cancelled
Checkers / spellcheck (push) Has been cancelled
CI / build (20, macos-latest) (push) Has been cancelled
CI / build (20, ubuntu-latest) (push) Has been cancelled
CI / build (20, windows-latest) (push) Has been cancelled
CI / build (22, macos-latest) (push) Has been cancelled
CI / build (22, ubuntu-latest) (push) Has been cancelled
CI / build (22, windows-latest) (push) Has been cancelled
CI / build (24, macos-latest) (push) Has been cancelled
CI / build (24, ubuntu-latest) (push) Has been cancelled
CI / build (24, windows-latest) (push) Has been cancelled
CI / pnpm (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
TestRepos / build (latest, ubuntu-latest) (push) Has been cancelled
UpdateTestRepos / update (push) Has been cancelled
Some checks failed
Checkers / linkcheck (push) Has been cancelled
Checkers / spellcheck (push) Has been cancelled
CI / build (20, macos-latest) (push) Has been cancelled
CI / build (20, ubuntu-latest) (push) Has been cancelled
CI / build (20, windows-latest) (push) Has been cancelled
CI / build (22, macos-latest) (push) Has been cancelled
CI / build (22, ubuntu-latest) (push) Has been cancelled
CI / build (22, windows-latest) (push) Has been cancelled
CI / build (24, macos-latest) (push) Has been cancelled
CI / build (24, ubuntu-latest) (push) Has been cancelled
CI / build (24, windows-latest) (push) Has been cancelled
CI / pnpm (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
TestRepos / build (latest, ubuntu-latest) (push) Has been cancelled
UpdateTestRepos / update (push) Has been cancelled
This commit is contained in:
parent
b3564ea841
commit
7b709a3ac0
2 changed files with 13 additions and 6 deletions
|
|
@ -47,6 +47,9 @@ textarea {
|
|||
font-style: italic;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.warning {
|
||||
background: rgb(255, 255, 0, 0.5);
|
||||
}
|
||||
.error {
|
||||
background: rgb(255, 0, 0, 0.3);
|
||||
}
|
||||
|
|
@ -67,7 +70,7 @@ textarea {
|
|||
min-height: 0;
|
||||
}
|
||||
.highlight {
|
||||
background: rgb(255, 0, 0, 0.8);
|
||||
background: rgb(0, 255, 255, 0.8);
|
||||
}
|
||||
.inset {
|
||||
box-sizing: border-box;
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@
|
|||
return `[Unsupported renderer "${renderer}"]`;
|
||||
}
|
||||
|
||||
// Highlight error ranges
|
||||
function highlightErrors(results, className) {
|
||||
// Highlight ranges
|
||||
function highlightRanges(results, className) {
|
||||
for (const result of results) {
|
||||
const { errorRange, lineNumber } = result;
|
||||
const line = document.getElementById(`l${lineNumber}`);
|
||||
|
|
@ -150,14 +150,18 @@
|
|||
sanitize(result.errorContext) +
|
||||
"\"</span>]" :
|
||||
"") +
|
||||
" [<span class='detail'>" +
|
||||
result.severity +
|
||||
"</span>]" +
|
||||
(result.fixInfo ?
|
||||
" [<a href='#fix' target='" +
|
||||
resultJson +
|
||||
"' class='detail'>Fix</a>]" :
|
||||
"");
|
||||
}).join("<br/>");
|
||||
// Highlight errors
|
||||
highlightErrors(allLintErrors, "error");
|
||||
// Highlight errors and warnings
|
||||
highlightRanges(allLintErrors.filter((error) => error.severity === "warning"), "warning");
|
||||
highlightRanges(allLintErrors.filter((error) => error.severity === "error"), "error");
|
||||
}
|
||||
|
||||
// Load from a string or File object
|
||||
|
|
@ -216,7 +220,7 @@
|
|||
for (const element of [ ...document.getElementsByClassName("highlight") ]) {
|
||||
element.classList.remove("highlight");
|
||||
}
|
||||
highlightErrors([ resultJson ], "highlight");
|
||||
highlightRanges([ resultJson ], "highlight");
|
||||
var line = document.getElementById(`l${resultJson.lineNumber}`);
|
||||
line.scrollIntoView();
|
||||
e.preventDefault();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue