File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -418,6 +418,9 @@ export class _Tokenizer {
418
418
if ( lastItem ) {
419
419
lastItem . raw = lastItem . raw . trimEnd ( ) ;
420
420
lastItem . text = lastItem . text . trimEnd ( ) ;
421
+ } else {
422
+ // not a list since there were no items
423
+ return ;
421
424
}
422
425
list . raw = list . raw . trimEnd ( ) ;
423
426
Original file line number Diff line number Diff line change @@ -127,6 +127,20 @@ describe('marked unit', () => {
127
127
assert . strictEqual ( html , '<p>Not Underlined A</p>\n<u>Underlined B</u>\n<p>Not Underlined C\n:Not Underlined D</p>\n' ) ;
128
128
} ) ;
129
129
130
+ it ( 'should not return list if no items' , ( ) => {
131
+ const noHr = {
132
+ tokenizer : {
133
+ hr ( ) {
134
+ return undefined ;
135
+ } ,
136
+ } ,
137
+ } ;
138
+ marked . use ( noHr ) ;
139
+ const markdown = '- - -' ;
140
+ const html = marked . parse ( markdown ) ;
141
+ assert . strictEqual ( html , '<p>- - -</p>\n' ) ;
142
+ } ) ;
143
+
130
144
it ( 'should use custom inline tokenizer + renderer extensions' , ( ) => {
131
145
const underline = {
132
146
name : 'underline' ,
You can’t perform that action at this time.
0 commit comments