Skip to content

Commit 41a8cad

Browse files
authored
Merge pull request #1248 from UziTech/paragraph-type
fix paragraph type
2 parents 37c0324 + 484deb5 commit 41a8cad

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

lib/marked.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var block = {
3333
def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
3434
table: noop,
3535
lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
36-
paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)+)/,
36+
paragraph: /^([^\n]+(?:\n?(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)+)/,
3737
text: /^[^\n]+/
3838
};
3939

test/unit/marked-spec.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
var marked = require('../../lib/marked.js');
22

3-
it('should run the test', function () {
4-
spyOn(marked, 'parse').and.callThrough();
5-
marked.parse('Hello World!');
6-
expect(marked.parse).toHaveBeenCalled();
7-
});
8-
93
describe('Test heading ID functionality', function() {
104
it('should add id attribute by default', function() {
115
var renderer = new marked.Renderer(marked.defaults);
@@ -19,3 +13,15 @@ describe('Test heading ID functionality', function() {
1913
expect(header).toBe('<h1>test</h1>\n');
2014
});
2115
});
16+
17+
describe('Test paragraph token type', function () {
18+
it('should use the "paragraph" type on top level', function () {
19+
const md = 'A Paragraph.\n\n> A blockquote\n\n- list item\n';
20+
21+
const tokens = marked.lexer(md);
22+
23+
expect(tokens[0].type).toBe('paragraph');
24+
expect(tokens[3].type).toBe('paragraph');
25+
expect(tokens[7].type).toBe('text');
26+
});
27+
});

0 commit comments

Comments
 (0)