File tree 2 files changed +29
-3
lines changed 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,13 @@ function exitParagraphWithTaskListItem(token) {
23
23
) {
24
24
// Must start with a space or a tab.
25
25
head . value = head . value . slice ( 1 )
26
- head . position . start . column ++
27
- head . position . start . offset ++
28
- node . position . start = Object . assign ( { } , head . position . start )
26
+ if ( head . value . length === 0 ) {
27
+ node . children . shift ( )
28
+ } else {
29
+ head . position . start . column ++
30
+ head . position . start . offset ++
31
+ node . position . start = Object . assign ( { } , head . position . start )
32
+ }
29
33
}
30
34
31
35
this . exit ( token )
Original file line number Diff line number Diff line change @@ -140,6 +140,28 @@ test('markdown -> mdast', function (t) {
140
140
'should not support a task list item when not in a list item'
141
141
)
142
142
143
+ t . deepEqual (
144
+ removePosition (
145
+ fromMarkdown ( '* [x] *b*' , {
146
+ extensions : [ syntax ] ,
147
+ mdastExtensions : [ taskListItem . fromMarkdown ]
148
+ } ) ,
149
+ true
150
+ ) . children [ 0 ] . children [ 0 ] ,
151
+ {
152
+ type : 'listItem' ,
153
+ spread : false ,
154
+ checked : true ,
155
+ children : [
156
+ {
157
+ type : 'paragraph' ,
158
+ children : [ { type : 'emphasis' , children : [ { type : 'text' , value : 'b' } ] } ]
159
+ }
160
+ ]
161
+ } ,
162
+ 'should support a text construct after the checkbox'
163
+ )
164
+
143
165
t . end ( )
144
166
} )
145
167
You can’t perform that action at this time.
0 commit comments