super-productivity/packages/plugin-dev/sync-md/quick-test.ts
Johannes Millan ceb9806ce1 fix(sync-md): correct markdown parsing for asterisk format tasks
- Fix regex to handle both dash (-) and asterisk (*) prefixed tasks
- Add quick test to verify parsing works for both formats
- Ensure proper bullet/checkbox distinction in markdown parsing
2025-06-24 21:04:38 +02:00

27 lines
679 B
JavaScript

#!/usr/bin/env node
import { BidirectionalSync } from './src/syncLogic';
async function testParsing() {
const sync = new BidirectionalSync();
const markdown = `
- [ ] Task with dash
- [x] Subtask with dash
* [ ] Task with asterisk
* [x] Subtask with asterisk
`;
// Access private method for testing
const parsed = (sync as any).parseMarkdown(markdown);
console.log('Parsed tasks:');
parsed.forEach((task, i) => {
console.log(`${i + 1}. "${task.title}" (${task.isDone ? 'done' : 'pending'})`);
task.subTasks.forEach((sub, j) => {
console.log(` ${j + 1}. "${sub.title}" (${sub.isDone ? 'done' : 'pending'})`);
});
});
}
testParsing();