Skip to content

Commit

Permalink
Fix emphasis with underscore inside word
Browse files Browse the repository at this point in the history
  • Loading branch information
mccraveiro committed Dec 20, 2018
1 parent d010745 commit 4661b3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ var inline = {
code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
br: /^( {2,}|\\)\n(?!\s*$)/,
del: noop,
text: /^(`+|[^`])[\s\S]*?(?=[\\<!\[`*]|\b_| {2,}\n|$)/
text: /^(`+|[^`])[\s\S]*?(?=[\\<!\[`*]|(?<=[\spunctuation])\b_| {2,}\n|$)/
};

// list of punctuation marks from common mark spec
Expand Down Expand Up @@ -584,6 +584,10 @@ inline.reflink = edit(inline.reflink)
.replace('label', inline._label)
.getRegex();

inline.text = edit(inline.text)
.replace('punctuation', inline._punctuation)
.getRegex();

/**
* Normal Inline Grammar
*/
Expand Down
2 changes: 1 addition & 1 deletion test/specs/commonmark/commonmark-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ describe('CommonMark 0.28 Emphasis and strong emphasis', function() {
var section = 'Emphasis and strong emphasis';

// var shouldPassButFails = [];
var shouldPassButFails = [334, 342, 348, 349, 352, 353, 360, 368, 369, 371, 372, 378, 380, 381, 382, 387, 388, 392, 393, 394, 395, 396, 402, 403, 409, 419, 420, 421, 422, 423, 424, 431, 432, 433, 434, 435, 436, 443, 444, 445, 448, 449, 453, 454, 455, 457, 458];
var shouldPassButFails = [334, 348, 349, 352, 353, 360, 369, 371, 372, 378, 380, 381, 382, 387, 388, 392, 393, 394, 395, 396, 402, 403, 409, 419, 420, 421, 422, 423, 424, 431, 432, 433, 434, 435, 436, 443, 444, 445, 448, 449, 453, 454, 455, 457, 458];

var willNotBeAttemptedByCoreTeam = [];

Expand Down

0 comments on commit 4661b3b

Please sign in to comment.