My blog

update html validator plugin

pyrox.dev aa796bee 9d5a42f2

verified
+6 -1
+6 -1
plugins/validateHTML.ts
··· 3 3 import { merge } from "lume/core/utils/object.ts"; 4 4 import { log } from "lume/core/utils/log.ts"; 5 5 6 + // validateHTML Plugin, by dish 7 + // version 1.0.1 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 - var reports: Array<Promise<Report>> = []; 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 + // Clear the reports table to ensure we don't get duplicates 36 + reports = []; 32 37 33 38 if (merged.valid) { 34 39 log.info("[validateHTML] Validation successful!");