tangled
alpha
login
or
join now
pyrox.dev
/
blog
0
fork
atom
My blog
0
fork
atom
overview
issues
pulls
pipelines
update html validator plugin
pyrox.dev
1 year ago
aa796bee
9d5a42f2
verified
This commit was signed with the committer's
known signature
.
pyrox.dev
SSH Key Fingerprint:
SHA256:ihSg8ro3xVhqiuGLMtUGTeMVgmEMlaXvSS4AFyYcM/o=
+6
-1
1 changed file
expand all
collapse all
unified
split
plugins
validateHTML.ts
+6
-1
plugins/validateHTML.ts
reviewed
···
3
3
import { merge } from "lume/core/utils/object.ts";
4
4
import { log } from "lume/core/utils/log.ts";
5
5
6
6
+
// validateHTML Plugin, by dish
7
7
+
// version 1.0.1
8
8
+
6
9
export const defaults: ConfigData = {
7
10
extends: ["html-validate:recommended", "html-validate:document"],
8
11
rules: {
···
23
26
site.process([".html"], validatePages);
24
27
25
28
async function validatePages(pages: Lume.Page[]) {
26
26
-
var reports: Array<Promise<Report>> = [];
29
29
+
let reports: Array<Promise<Report>> = [];
27
30
for (const page of pages) {
28
31
const report = await htmlvalidate.validateString(page.content as string, page.outputPath);
29
32
reports.push(report);
30
33
}
31
34
const merged: Report | Promise<Report> = Reporter.merge(reports);
35
35
+
// Clear the reports table to ensure we don't get duplicates
36
36
+
reports = [];
32
37
33
38
if (merged.valid) {
34
39
log.info("[validateHTML] Validation successful!");