File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
packages/docusaurus-theme-common/src/utils/__tests__ Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,30 @@ bbbbb",
70
70
}
71
71
` ;
72
72
73
+ exports [` parseLines handles CRLF line breaks with highlight comments correctly 1` ] = `
74
+ {
75
+ " code" : " aaaaa
76
+ bbbbb " ,
77
+ " lineClassNames" : {
78
+ " 1" : [
79
+ " theme-code-block-highlighted-line" ,
80
+ ],
81
+ },
82
+ }
83
+ ` ;
84
+
85
+ exports [` parseLines handles CRLF line breaks with highlight metastring 1` ] = `
86
+ {
87
+ " code" : " aaaaa
88
+ bbbbb " ,
89
+ " lineClassNames" : {
90
+ " 1" : [
91
+ " theme-code-block-highlighted-line" ,
92
+ ],
93
+ },
94
+ }
95
+ ` ;
96
+
73
97
exports [` parseLines handles one line with multiple class names 1` ] = `
74
98
{
75
99
" code" : "
Original file line number Diff line number Diff line change @@ -360,6 +360,29 @@ line
360
360
) ,
361
361
) . toMatchSnapshot ( ) ;
362
362
} ) ;
363
+
364
+ it ( 'handles CRLF line breaks with highlight comments correctly' , ( ) => {
365
+ expect (
366
+ parseLines (
367
+ `aaaaa\r\n// highlight-start\r\nbbbbb\r\n// highlight-end\r\n` ,
368
+ {
369
+ metastring : '' ,
370
+ language : 'js' ,
371
+ magicComments : defaultMagicComments ,
372
+ } ,
373
+ ) ,
374
+ ) . toMatchSnapshot ( ) ;
375
+ } ) ;
376
+
377
+ it ( 'handles CRLF line breaks with highlight metastring' , ( ) => {
378
+ expect (
379
+ parseLines ( `aaaaa\r\nbbbbb\r\n` , {
380
+ metastring : '{2}' ,
381
+ language : 'js' ,
382
+ magicComments : defaultMagicComments ,
383
+ } ) ,
384
+ ) . toMatchSnapshot ( ) ;
385
+ } ) ;
363
386
} ) ;
364
387
365
388
describe ( 'getLineNumbersStart' , ( ) => {
You can’t perform that action at this time.
0 commit comments