Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix paragraph type #1248

Merged
merged 4 commits into from
May 2, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var block = {
def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
table: noop,
lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)+)/,
paragraph: /^([^\n]+(?:\n?(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)+)/,
text: /^[^\n]+/
};

Expand Down
13 changes: 12 additions & 1 deletion test/specs/original/specs-spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var specTests = require('../../');
var marked = require('../../../lib/marked.js');
var specTests = require('../../index.js');

it('should run spec tests', function () {
// hide output
Expand All @@ -10,3 +11,13 @@ it('should run spec tests', function () {
fail();
}
});

it('should use the correct paragraph type', function () {
const md = 'A Paragraph.\n\n> A blockquote\n\n- list item\n';

const tokens = marked.lexer(md);

expect(tokens[0].type).toBe('paragraph');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think this makes more sense to be in the unit tests, yeah? The construction seems similar enough and this isn't, technically speaking, checking a specific spec or the output as a whole.

expect(tokens[3].type).toBe('paragraph');
expect(tokens[7].type).toBe('text');
});