MCPcopy Index your code
hub / github.com/github/awesome-copilot / parseChecklist

Function parseChecklist

extensions/java-modernization-studio/scan.mjs:161–178  ·  view source on GitHub ↗
(md)

Source from the content-addressed store, hash-verified

159// Parse GitHub-style task list items: "- [ ] ...", "- [x] ...", "- [/] ...".
160// Each item also carries the nearest preceding heading as its `section`.
161function parseChecklist(md) {
162 const items = [];
163 let section = null;
164 for (const line of md.split(/\r?\n/)) {
165 const h = line.match(/^\s*#{1,6}\s+(.*\S)\s*$/);
166 if (h) { section = stripMd(h[1]); continue; }
167 const m = line.match(/^\s*[-*]\s+\[([ xX/~\-])\]\s+(.*\S)\s*$/);
168 if (!m) continue;
169 const mark = m[1].toLowerCase();
170 let status = "pending";
171 if (mark === "x") status = "done";
172 else if (mark === "/" || mark === "~" || mark === "-") status = "in_progress";
173 const inline = statusFromText(m[2]);
174 if (inline) status = inline;
175 items.push({ title: stripMd(m[2]), status, section });
176 }
177 return items;
178}
179
180// Fallbacks when there are no checkbox items: numbered steps, then H2/H3 headings.
181function parseLooseSteps(md) {

Callers 1

parseStepsFunction · 0.70

Calls 2

stripMdFunction · 0.85
statusFromTextFunction · 0.85

Tested by

no test coverage detected