Skip to content

Commit 9a259ca

Browse files
authored
Merge pull request markedjs#1315 from barrywoolgar/patch-1
Updated inline grammar regexes for strong and em
2 parents 71f1076 + ff9b537 commit 9a259ca

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

lib/marked.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,8 @@ var inline = {
540540
link: /^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,
541541
reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,
542542
nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
543-
strong: /^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)|^__([^\s])__(?!_)|^\*\*([^\s])\*\*(?!\*)/,
544-
em: /^_([^\s][\s\S]*?[^\s_])_(?!_)|^_([^\s_][\s\S]*?[^\s])_(?!_)|^\*([^\s][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*][\s\S]*?[^\s])\*(?!\*)|^_([^\s_])_(?!_)|^\*([^\s*])\*(?!\*)/,
543+
strong: /^__([^\s])__(?!_)|^\*\*([^\s])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,
544+
em: /^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_)|^_([^\s_][\s\S]*?[^\s])_(?!_)|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,
545545
code: /^(`+)\s*([\s\S]*?[^`]?)\s*\1(?!`)/,
546546
br: /^( {2,}|\\)\n(?!\s*$)/,
547547
del: noop,

test/new/cm_strong_and_em.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<p>So <em>a</em> single <em>word</em> followed <em>b</em>y <em>a</em>nother</p>
2+
3+
<p>So <strong>a</strong> single <strong>word</strong> followed <strong>b</strong>y <strong>a</strong>nother</p>
4+
5+
<p>So <em>a</em> single <em>word</em> followed <em>b</em>y <em>a</em>nother</p>
6+
7+
<p>So <strong>a</strong> single <strong>word</strong> followed <strong>b</strong>y <strong>a</strong>nother</p>

test/new/cm_strong_and_em.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
So *a* single *word* followed *b*y *a*nother
2+
3+
So **a** single **word** followed **b**y **a**nother
4+
5+
So _a_ single _word_ followed _b_y _a_nother
6+
7+
So __a__ single __word__ followed __b__y __a__nother

test/specs/commonmark/commonmark-spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ describe('CommonMark 0.28 Emphasis and strong emphasis', function() {
334334
var section = 'Emphasis and strong emphasis';
335335

336336
// var shouldPassButFails = [];
337-
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];
337+
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];
338338

339339
var willNotBeAttemptedByCoreTeam = [];
340340

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

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

354354
var willNotBeAttemptedByCoreTeam = [];
355355

0 commit comments

Comments
 (0)