Skip to content

Commit

Permalink
Merge pull request #1315 from barrywoolgar/patch-1
Browse files Browse the repository at this point in the history
Updated inline grammar regexes for strong and em
  • Loading branch information
styfle committed Aug 15, 2018
2 parents 8c0432f + 431884f commit 60688a4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/marked.js
Expand Up @@ -540,8 +540,8 @@ var inline = {
link: /^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,
reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,
nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
strong: /^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)|^__([^\s])__(?!_)|^\*\*([^\s])\*\*(?!\*)/,
em: /^_([^\s][\s\S]*?[^\s_])_(?!_)|^_([^\s_][\s\S]*?[^\s])_(?!_)|^\*([^\s][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*][\s\S]*?[^\s])\*(?!\*)|^_([^\s_])_(?!_)|^\*([^\s*])\*(?!\*)/,
strong: /^__([^\s])__(?!_)|^\*\*([^\s])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,
em: /^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_)|^_([^\s_][\s\S]*?[^\s])_(?!_)|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,
code: /^(`+)\s*([\s\S]*?[^`]?)\s*\1(?!`)/,
br: /^( {2,}|\\)\n(?!\s*$)/,
del: noop,
Expand Down
7 changes: 7 additions & 0 deletions test/new/cm_strong_and_em.html
@@ -0,0 +1,7 @@
<p>So <em>a</em> single <em>word</em> followed <em>b</em>y <em>a</em>nother</p>

<p>So <strong>a</strong> single <strong>word</strong> followed <strong>b</strong>y <strong>a</strong>nother</p>

<p>So <em>a</em> single <em>word</em> followed <em>b</em>y <em>a</em>nother</p>

<p>So <strong>a</strong> single <strong>word</strong> followed <strong>b</strong>y <strong>a</strong>nother</p>
7 changes: 7 additions & 0 deletions test/new/cm_strong_and_em.md
@@ -0,0 +1,7 @@
So *a* single *word* followed *b*y *a*nother

So **a** single **word** followed **b**y **a**nother

So _a_ single _word_ followed _b_y _a_nother

So __a__ single __word__ followed __b__y __a__nother
4 changes: 2 additions & 2 deletions test/specs/commonmark/commonmark-spec.js
Expand Up @@ -334,7 +334,7 @@ describe('CommonMark 0.28 Emphasis and strong emphasis', function() {
var section = 'Emphasis and strong emphasis';

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

var willNotBeAttemptedByCoreTeam = [];

Expand All @@ -349,7 +349,7 @@ describe('CommonMark 0.28 Links', function() {
var section = 'Links';

// var shouldPassButFails = [];
var shouldPassButFails = [474, 478, 483, 489, 490, 491, 492, 495, 496, 497, 499, 503, 504, 505, 507, 508, 509, 523, 535];
var shouldPassButFails = [474, 478, 483, 489, 490, 491, 495, 496, 497, 499, 503, 504, 507, 508, 509, 523];

var willNotBeAttemptedByCoreTeam = [];

Expand Down

0 comments on commit 60688a4

Please sign in to comment.