This commit is contained in:
team3
2026-09-22 13:14:06 +02:00
parent a62b587340
commit 2472e89b9c
15 changed files with 461 additions and 28 deletions

View File

@@ -77,3 +77,16 @@ function indent(spaces) {
const level = spaces.replace(/\t/g, ' ').length / 2;
return ' '.repeat(Math.floor(level) + 1);
}
// Was nach Enter am Ende dieser Zeile in der nächsten stehen soll.
// null: keine Liste. '': leerer Listenpunkt, der Marker soll weg. Sonst der Marker für den nächsten Punkt.
export function continueList(line) {
let m;
if ((m = line.match(/^(\s*)([-*+])\s+\[[ xX]\]\s+(.*)$/)))
return m[3].trim() ? `${m[1]}${m[2]} [ ] ` : '';
if ((m = line.match(/^(\s*)([-*+])\s+(.*)$/)))
return m[3].trim() ? `${m[1]}${m[2]} ` : '';
if ((m = line.match(/^(\s*)(\d+)([.)])\s+(.*)$/)))
return m[4].trim() ? `${m[1]}${Number(m[2]) + 1}${m[3]} ` : '';
return null;
}