mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-18 06:50:12 +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;
|
font-style: italic;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
.warning {
|
||||||
|
background: rgb(255, 255, 0, 0.5);
|
||||||
|
}
|
||||||
.error {
|
.error {
|
||||||
background: rgb(255, 0, 0, 0.3);
|
background: rgb(255, 0, 0, 0.3);
|
||||||
}
|
}
|
||||||
|
|
@ -67,7 +70,7 @@ textarea {
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
}
|
}
|
||||||
.highlight {
|
.highlight {
|
||||||
background: rgb(255, 0, 0, 0.8);
|
background: rgb(0, 255, 255, 0.8);
|
||||||
}
|
}
|
||||||
.inset {
|
.inset {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,8 @@
|
||||||
return `[Unsupported renderer "${renderer}"]`;
|
return `[Unsupported renderer "${renderer}"]`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Highlight error ranges
|
// Highlight ranges
|
||||||
function highlightErrors(results, className) {
|
function highlightRanges(results, className) {
|
||||||
for (const result of results) {
|
for (const result of results) {
|
||||||
const { errorRange, lineNumber } = result;
|
const { errorRange, lineNumber } = result;
|
||||||
const line = document.getElementById(`l${lineNumber}`);
|
const line = document.getElementById(`l${lineNumber}`);
|
||||||
|
|
@ -150,14 +150,18 @@
|
||||||
sanitize(result.errorContext) +
|
sanitize(result.errorContext) +
|
||||||
"\"</span>]" :
|
"\"</span>]" :
|
||||||
"") +
|
"") +
|
||||||
|
" [<span class='detail'>" +
|
||||||
|
result.severity +
|
||||||
|
"</span>]" +
|
||||||
(result.fixInfo ?
|
(result.fixInfo ?
|
||||||
" [<a href='#fix' target='" +
|
" [<a href='#fix' target='" +
|
||||||
resultJson +
|
resultJson +
|
||||||
"' class='detail'>Fix</a>]" :
|
"' class='detail'>Fix</a>]" :
|
||||||
"");
|
"");
|
||||||
}).join("<br/>");
|
}).join("<br/>");
|
||||||
// Highlight errors
|
// Highlight errors and warnings
|
||||||
highlightErrors(allLintErrors, "error");
|
highlightRanges(allLintErrors.filter((error) => error.severity === "warning"), "warning");
|
||||||
|
highlightRanges(allLintErrors.filter((error) => error.severity === "error"), "error");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load from a string or File object
|
// Load from a string or File object
|
||||||
|
|
@ -216,7 +220,7 @@
|
||||||
for (const element of [ ...document.getElementsByClassName("highlight") ]) {
|
for (const element of [ ...document.getElementsByClassName("highlight") ]) {
|
||||||
element.classList.remove("highlight");
|
element.classList.remove("highlight");
|
||||||
}
|
}
|
||||||
highlightErrors([ resultJson ], "highlight");
|
highlightRanges([ resultJson ], "highlight");
|
||||||
var line = document.getElementById(`l${resultJson.lineNumber}`);
|
var line = document.getElementById(`l${resultJson.lineNumber}`);
|
||||||
line.scrollIntoView();
|
line.scrollIntoView();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue