import { readFile } from "node:fs/promises"; const result = (state, description) => ({ state, description }); function readinessLines(markdown) { const lines = markdown.split(/\r?\n/u); const visible = []; let fence; let comment = false; for (const source of lines) { if (fence) { if ( new RegExp( `^ {0,3}${fence.character}{${fence.length},}\\s*$`, "u", ).test(source) ) fence = undefined; continue; } const opening = !comment && /^ {0,3}(`{3,}|~{3,})/u.exec(source); if (opening) { fence = { character: opening[1][0], length: opening[1].length }; continue; } let line = ""; let offset = 0; while (offset < source.length) { const marker = comment ? "-->" : "