(content: string)
| 409 | * @returns Object with the processed content and whether any changes were made |
| 410 | */ |
| 411 | export function resetMarkdownCheckboxes(content: string): { |
| 412 | content: string; |
| 413 | changed: boolean; |
| 414 | } { |
| 415 | // Match checkbox list items that are checked: - [x], * [x], + [x], 1. [x], etc. |
| 416 | // Pattern breakdown: |
| 417 | // ^(\s*) - Start of line, capture leading whitespace |
| 418 | // ([-*+]|\d+\.) - List marker: -, *, +, or number with dot |
| 419 | // (\s+\[) - Whitespace and opening bracket |
| 420 | // [xX] - The check mark (x or X) |
| 421 | // (\].*) - Closing bracket and rest of line |
| 422 | const checkboxPattern = /^(\s*)([-*+]|\d+\.)(\s+\[)[xX](\].*)/gm; |
| 423 | |
| 424 | let changed = false; |
| 425 | const result = content.replace(checkboxPattern, (match, indent, marker, beforeX, afterX) => { |
| 426 | changed = true; |
| 427 | return `${indent}${marker}${beforeX} ${afterX}`; |
| 428 | }); |
| 429 | |
| 430 | return { content: result, changed }; |
| 431 | } |
| 432 | |
| 433 | /** |
| 434 | * Checks if a recurring task is due on a specific date using RFC 5545 rrule |
no outgoing calls
no test coverage detected