File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ var regexByName = {
21
21
FENCES : / (?: ^ | \n ) * ( ` { 3 , } | ~ { 3 , } ) * (?: \S + ) ? * \n (?: [ \s \S ] + ?) \s * \4 * (?: \n + | $ ) / ,
22
22
DEF : / (?: ^ | \n ) * \[ ( [ ^ \] ] + ) \] : * < ? ( [ ^ \s > ] + ) > ? (?: + [ " ( ] ( [ ^ \n ] + ) [ " ) ] ) ? * (?: \n + | $ ) / ,
23
23
MACRO : / ! \[ : ( [ ^ \] ] + ) ( [ ^ \] ] * ) \] (?: \( ( [ ^ \) ] * ) \) ) ? / ,
24
- SLIDE_SEPARATOR : / (?: ^ | \n ) ( - - - ) (?: \n | $ ) / ,
24
+ SLIDE_SEPARATOR : / (?: ^ | \n ) ( ( - - - ? ) | ( \< \! - - \s + b r e a k \s + - - \> ? ) ) (?: \n | $ ) / ,
25
25
FRAGMENT_SEPARATOR : / (?: ^ | \n ) ( - - ) (? ! [ ^ \n ] ) / ,
26
26
NOTES_SEPARATOR : / (?: ^ | \n ) ( \? { 3 } ) (?: \n | $ ) /
27
27
} ;
Original file line number Diff line number Diff line change @@ -27,6 +27,24 @@ describe('Lexer', function () {
27
27
] ) ;
28
28
} ) ;
29
29
30
+ it ( 'should recognize silent separator' , function ( ) {
31
+ lexer . lex ( '\n<!-- break -->' ) . should . eql ( [
32
+ { type : 'separator' , text : '<!-- break -->' }
33
+ ] ) ;
34
+ } ) ;
35
+
36
+ it ( 'should not preserve trailing line breaks of silent separators' , function ( ) {
37
+ lexer . lex ( '\n<!-- break -->\n' ) . should . eql ( [
38
+ { type : 'separator' , text : '<!-- break -->' }
39
+ ] ) ;
40
+ } ) ;
41
+
42
+ it ( 'should ignore additional whitespace inside of silent separator' , function ( ) {
43
+ lexer . lex ( '\n<!-- break -->' ) . should . eql ( [
44
+ { type : 'separator' , text : '<!-- break -->' }
45
+ ] ) ;
46
+ } ) ;
47
+
30
48
it ( 'should recognize continued separator' , function ( ) {
31
49
lexer . lex ( '\n--' ) . should . eql ( [
32
50
{ type : 'separator' , text : '--' } ,
Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ describe('Parser', function () {
11
11
parser . parse ( '1\n---\n2\n---\n3' ) . length . should . equal ( 3 ) ;
12
12
} ) ;
13
13
14
+ it ( 'should handle multiple slides with the silent separator' , function ( ) {
15
+ parser . parse ( '1\n<!-- break -->\n2\n<!-- break -->\n3' ) . length . should . equal ( 3 ) ;
16
+ } ) ;
17
+
14
18
it ( 'should treat empty source as single slide' , function ( ) {
15
19
parser . parse ( '' ) . length . should . equal ( 1 ) ;
16
20
} ) ;
You can’t perform that action at this time.
0 commit comments