Skip to content

Commit 3289922

Browse files
committed
Merge branch 'pr-523' into develop
2 parents 39e41f0 + a2c3276 commit 3289922

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

src/remark/lexer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var regexByName = {
2121
FENCES: /(?:^|\n) *(`{3,}|~{3,}) *(?:\S+)? *\n(?:[\s\S]+?)\s*\4 *(?:\n+|$)/,
2222
DEF: /(?:^|\n) *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,
2323
MACRO: /!\[:([^\] ]+)([^\]]*)\](?:\(([^\)]*)\))?/,
24-
SLIDE_SEPARATOR: /(?:^|\n)(---)(?:\n|$)/,
24+
SLIDE_SEPARATOR: /(?:^|\n)((---?)|(\<\!--\s+break\s+--\>?))(?:\n|$)/,
2525
FRAGMENT_SEPARATOR: /(?:^|\n)(--)(?![^\n])/,
2626
NOTES_SEPARATOR: /(?:^|\n)(\?{3})(?:\n|$)/
2727
};

test/remark/lexer_test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,24 @@ describe('Lexer', function () {
2727
]);
2828
});
2929

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+
3048
it('should recognize continued separator', function () {
3149
lexer.lex('\n--').should.eql([
3250
{type: 'separator', text: '--'},

test/remark/parser_test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ describe('Parser', function () {
1111
parser.parse('1\n---\n2\n---\n3').length.should.equal(3);
1212
});
1313

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+
1418
it('should treat empty source as single slide', function () {
1519
parser.parse('').length.should.equal(1);
1620
});

0 commit comments

Comments
 (0)