(md)
| 179 | |
| 180 | // Fallbacks when there are no checkbox items: numbered steps, then H2/H3 headings. |
| 181 | function parseLooseSteps(md) { |
| 182 | const numbered = []; |
| 183 | let section = null; |
| 184 | for (const line of md.split(/\r?\n/)) { |
| 185 | const h = line.match(/^\s*#{1,6}\s+(.*\S)\s*$/); |
| 186 | if (h) { section = stripMd(h[1]); continue; } |
| 187 | const m = line.match(/^\s*\d+[.)]\s+(.*\S)\s*$/); |
| 188 | if (m) numbered.push({ title: stripMd(m[1]), status: statusFromText(m[1]) || "pending", section }); |
| 189 | } |
| 190 | if (numbered.length) return numbered; |
| 191 | |
| 192 | const headings = []; |
| 193 | for (const line of md.split(/\r?\n/)) { |
| 194 | const m = line.match(/^\s*#{2,4}\s+(.*\S)\s*$/); |
| 195 | if (m) headings.push({ title: stripMd(m[1]), status: statusFromText(m[1]) || "pending", section: null }); |
| 196 | } |
| 197 | return headings; |
| 198 | } |
| 199 | |
| 200 | function parseSteps(md) { |
| 201 | if (!md) return []; |
no test coverage detected