File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 1+ import { TaskRegularExpressions } from './TaskRegularExpressions' ;
2+
13export class ListItem {
24 /** The original line read from file.
35 *
@@ -10,7 +12,7 @@ export class ListItem {
1012 public readonly description : string ;
1113
1214 constructor ( originalMarkdown : string , parent : ListItem | null ) {
13- this . description = originalMarkdown . replace ( / ^ \s * - / , '' ) ;
15+ this . description = originalMarkdown . replace ( TaskRegularExpressions . listItemRegex , '' ) . trim ( ) ;
1416 this . originalMarkdown = originalMarkdown ;
1517 this . parent = parent ;
1618
Original file line number Diff line number Diff line change @@ -78,12 +78,12 @@ describe('list item tests', () => {
7878
7979 it . each ( [
8080 [ '- ' , true ] ,
81- [ '* ' , false ] ,
82- [ '+ ' , false ] ,
83- [ '17. ' , false ] ,
81+ [ '* ' , true ] ,
82+ [ '+ ' , true ] ,
83+ [ '17. ' , true ] ,
8484 [ ' - ' , true ] ,
85- [ '> - ' , false ] ,
86- [ '> > - ' , false ] ,
85+ [ '> - ' , true ] ,
86+ [ '> > - ' , true ] ,
8787 ] ) ( 'should parse description with list item prefix: "%s"' , ( prefix : string , shouldPass ) => {
8888 const description = 'stuff' ;
8989 const line = prefix + description ;
You can’t perform that action at this time.
0 commit comments