Skip to content

Commit

Permalink
Fix <em> issue with mixed content, marked#1410
Browse files Browse the repository at this point in the history
  • Loading branch information
yahtnif committed Jun 20, 2019
1 parent d44e3bc commit 45c1d85
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions __tests__/base/emphasis
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,30 @@ _test_. _test_: _test_! _test_? _test_-
foo _____


- code bold italic
- [***`named link`***][some-url]
- ***[`named link`][some-url]***
- [___`named link`___][some-url]
- ___[`named link`][some-url]___
- [*__`named link`__*][some-url]
- [__*`named link`*__][some-url]
- __*[`named link`][some-url]*__

[some-url]: https://www.google.com



<p><em>test</em>. <em>test</em>: <em>test</em>! <em>test</em>? <em>test</em>-</p>
<p>foo _____</p>
<ul>
<li>code bold italic<ul>
<li><a href="https://www.google.com"><strong><em><code>named link</code></em></strong></a></li>
<li><strong><em><a href="https://www.google.com"><code>named link</code></a></em></strong></li>
<li><a href="https://www.google.com"><strong><em><code>named link</code></em></strong></a></li>
<li><strong><em><a href="https://www.google.com"><code>named link</code></a></em></strong></li>
<li><a href="https://www.google.com"><em><strong><code>named link</code></strong></em></a></li>
<li><a href="https://www.google.com"><strong><em><code>named link</code></em></strong></a></li>
<li><strong><em><a href="https://www.google.com"><code>named link</code></a></em></strong></li>
</ul>
</li>
</ul>
2 changes: 1 addition & 1 deletion src/inline-lexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export class InlineLexer {
autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
br: /^( {2,}|\\)\n(?!\s*$)/,
code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
em: /^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\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])\*(?!\*)/,
escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
link: /^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,
nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
Expand Down

0 comments on commit 45c1d85

Please sign in to comment.