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 {
418418 if ( lastItem ) {
419419 lastItem . raw = lastItem . raw . trimEnd ( ) ;
420420 lastItem . text = lastItem . text . trimEnd ( ) ;
421+ } else {
422+ // not a list since there were no items
423+ return ;
421424 }
422425 list . raw = list . raw . trimEnd ( ) ;
423426
Original file line number Diff line number Diff line change @@ -127,6 +127,20 @@ describe('marked unit', () => {
127127 assert . strictEqual ( html , '<p>Not Underlined A</p>\n<u>Underlined B</u>\n<p>Not Underlined C\n:Not Underlined D</p>\n' ) ;
128128 } ) ;
129129
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+
130144 it ( 'should use custom inline tokenizer + renderer extensions' , ( ) => {
131145 const underline = {
132146 name : 'underline' ,
You can’t perform that action at this time.
0 commit comments