update
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user