MCPcopy Create free account
hub / github.com/ShipSecAI/studio / toggleNthTask

Function toggleNthTask

frontend/src/components/ui/markdown.tsx:266–280  ·  view source on GitHub ↗
(md: string, index: number)

Source from the content-addressed store, hash-verified

264 });
265
266function toggleNthTask(md: string, index: number): string {
267 let counter = 0;
268 return md.replace(
269 /(^|\n)([\t ]*)([-*]|\d+\.)[\t ]+\[( |x|X)\]/g,
270 (match, prefix: string, indent: string, bullet: string, mark: string) => {
271 if (counter === index) {
272 const next = mark.toLowerCase() === 'x' ? ' ' : 'x';
273 counter++;
274 return `${prefix}${indent}${bullet} [${next}]`;
275 }
276 counter++;
277 return match;
278 },
279 );
280}
281
282// Track expected content after checkbox toggles to skip re-renders
283// Key: dataTestId, Value: expected content string

Callers 1

markdown.tsxFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected