revert changes

Signed-off-by: boojack <stevenlgtm@gmail.com>
This commit is contained in:
boojack 2025-12-11 07:52:23 +08:00 committed by GitHub
parent e0984df2d3
commit 5e1358d10d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 10 deletions

View File

@ -24,15 +24,7 @@ export function toggleTaskAtLine(markdown: string, lineNumber: number, checked:
return lines.join("\n");
}
export function isInsideCodeBlock(lines :string [] , index : number):boolean{
let inside = false;
for(let i = 0 ; i <= index ; i++){
if(lines[i].startsWith("```")){
inside = !inside;
}
}
return inside;
}
export function toggleTaskAtIndex(markdown: string, taskIndex: number, checked: boolean): string {
const lines = markdown.split("\n");
const taskPattern = /^(\s*[-*+]\s+)\[([ xX])\](\s+.*)$/;
@ -40,7 +32,6 @@ export function toggleTaskAtIndex(markdown: string, taskIndex: number, checked:
let currentTaskIndex = 0;
for (let i = 0; i < lines.length; i++) {
if (isInsideCodeBlock(lines, i)) continue;
const line = lines[i];
const match = line.match(taskPattern);