update html validator plugin

pyrox.dev aa796bee 9d5a42f2

verified
Changed files
+6 -1
plugins
+6 -1
plugins/validateHTML.ts
···
import { merge } from "lume/core/utils/object.ts";
import { log } from "lume/core/utils/log.ts";
export const defaults: ConfigData = {
extends: ["html-validate:recommended", "html-validate:document"],
rules: {
···
site.process([".html"], validatePages);
async function validatePages(pages: Lume.Page[]) {
-
var reports: Array<Promise<Report>> = [];
for (const page of pages) {
const report = await htmlvalidate.validateString(page.content as string, page.outputPath);
reports.push(report);
}
const merged: Report | Promise<Report> = Reporter.merge(reports);
if (merged.valid) {
log.info("[validateHTML] Validation successful!");
···
import { merge } from "lume/core/utils/object.ts";
import { log } from "lume/core/utils/log.ts";
+
// validateHTML Plugin, by dish
+
// version 1.0.1
+
export const defaults: ConfigData = {
extends: ["html-validate:recommended", "html-validate:document"],
rules: {
···
site.process([".html"], validatePages);
async function validatePages(pages: Lume.Page[]) {
+
let reports: Array<Promise<Report>> = [];
for (const page of pages) {
const report = await htmlvalidate.validateString(page.content as string, page.outputPath);
reports.push(report);
}
const merged: Report | Promise<Report> = Reporter.merge(reports);
+
// Clear the reports table to ensure we don't get duplicates
+
reports = [];
if (merged.valid) {
log.info("[validateHTML] Validation successful!");