Skip to content

Commit

Permalink
Merge pull request markedjs#1636 from Scrum/master
Browse files Browse the repository at this point in the history
fix: Intra-word emphasis can match the wrong asterisks
  • Loading branch information
styfle committed Apr 10, 2020
2 parents 0b5842e + a4b1f78 commit 04adedf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rules.js
Expand Up @@ -169,7 +169,7 @@ const inline = {
reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,
nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
strong: /^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,
em: /^_([^\s_])_(?!_)|^\*([^\s*<\[])\*(?!\*)|^_([^\s<][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_<][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s<"][\s\S]*?[^\s\*])\*(?!\*|[^\spunctuation])|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,
em: /^_([^\s_])_(?!_)|^\*([^\s*<\[])\*(?!\*)|^_([^\s<][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_<][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s<"][\s\S]*?[^\s\[\*])\*(?![\]`punctuation])|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,
code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
br: /^( {2,}|\\)\n(?!\s*$)/,
del: noopTest,
Expand Down
2 changes: 2 additions & 0 deletions test/specs/new/em_2char.html
Expand Up @@ -23,3 +23,5 @@
<p><em>1_</em></p>

<p><em>1*</em></p>

<p>It’s levi<em>OH</em>sa, not levio<em>SAH.</em></p>
2 changes: 2 additions & 0 deletions test/specs/new/em_2char.md
Expand Up @@ -23,3 +23,5 @@ _ 123_
_1__

*1**

It’s levi*OH*sa, not levio*SAH.*

0 comments on commit 04adedf

Please sign in to comment.