File tree 1 file changed +30
-6
lines changed
1 file changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -299,16 +299,26 @@ Lexer.prototype.token = function(src, top) {
299
299
type : 'blockquote_start'
300
300
} ) ;
301
301
302
- cap = cap [ 0 ] . replace ( / ^ * > ? / gm, '' ) ;
302
+ var blockquote = cap [ 0 ] . replace ( / ^ * > ? / gm, '' ) ;
303
+ var count = 1 ;
304
+ while ( blockquote . match ( / ^ { 0 , 3 } > / ) ) {
305
+ count ++ ;
306
+ this . tokens . push ( {
307
+ type : 'blockquote_start'
308
+ } ) ;
309
+ blockquote = blockquote . replace ( / ^ * > ? / gm, '' ) ;
310
+ }
303
311
304
312
// Pass `top` to keep the current
305
313
// "toplevel" state. This is exactly
306
314
// how markdown.pl works.
307
- this . token ( cap , top ) ;
315
+ this . token ( blockquote , top ) ;
308
316
309
- this . tokens . push ( {
310
- type : 'blockquote_end'
311
- } ) ;
317
+ for ( i = 0 ; i < count ; i ++ ) {
318
+ this . tokens . push ( {
319
+ type : 'blockquote_end'
320
+ } ) ;
321
+ }
312
322
313
323
continue ;
314
324
}
@@ -1233,13 +1243,27 @@ Parser.prototype.tok = function() {
1233
1243
return this . renderer . table ( header , body ) ;
1234
1244
}
1235
1245
case 'blockquote_start' : {
1246
+ var count = 1 ;
1247
+ while ( this . peek ( ) && this . peek ( ) . type === 'blockquote_start' ) {
1248
+ this . next ( ) ;
1249
+ count ++ ;
1250
+ }
1251
+
1236
1252
body = '' ;
1237
1253
1238
1254
while ( this . next ( ) . type !== 'blockquote_end' ) {
1239
1255
body += this . tok ( ) ;
1240
1256
}
1241
1257
1242
- return this . renderer . blockquote ( body ) ;
1258
+ while ( this . peek ( ) && this . peek ( ) . type === 'blockquote_end' ) {
1259
+ this . next ( ) ;
1260
+ }
1261
+
1262
+ for ( i = 0 ; i < count ; i ++ ) {
1263
+ body = this . renderer . blockquote ( body ) ;
1264
+ }
1265
+
1266
+ return body ;
1243
1267
}
1244
1268
case 'list_start' : {
1245
1269
body = '' ;
You can’t perform that action at this time.
0 commit comments