diff options
author | facelessuser <faceless.shop@gmail.com> | 2014-11-17 18:36:43 -0700 |
---|---|---|
committer | facelessuser <faceless.shop@gmail.com> | 2014-11-17 18:36:43 -0700 |
commit | 609faad76b80ff10da0e471183ad0cede3221571 (patch) | |
tree | 453b010faeff88f8c9f94175b70352a1e8e71876 /tests | |
parent | f0357b28ef1723929146eabe6571d7c436c90c34 (diff) | |
download | markdown-609faad76b80ff10da0e471183ad0cede3221571.tar.gz markdown-609faad76b80ff10da0e471183ad0cede3221571.tar.bz2 markdown-609faad76b80ff10da0e471183ad0cede3221571.zip |
Issue #365 Bold/Italic nesting fix
The logic for the current regex for strong/em and em/strong was sound,
but the way it was implemented caused some unintended side effects.
Whether it is a quirk with regex in general or just with Python’s re
engine, I am not sure. Put basically `(\*|_){3}` causes issues with
nested bold/italic. So, allowing the group to be defined, and then
using the group number to specify the remaining sequential chars is a
better way that works more reliably `(\*|_)\2{2}. Test from issue #365
was also added to check for this case in the future.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/misc/nested-patterns.html | 4 | ||||
-rw-r--r-- | tests/misc/nested-patterns.txt | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/tests/misc/nested-patterns.html b/tests/misc/nested-patterns.html index 8c46a58..1c7bb43 100644 --- a/tests/misc/nested-patterns.html +++ b/tests/misc/nested-patterns.html @@ -5,4 +5,6 @@ <strong><a href="http://example.com"><em>link</em></a></strong> <strong><a href="http://example.com"><em>link</em></a></strong> <a href="http://example.com"><strong><em>link</em></strong></a></p> -<p><strong><em>I am <strong><em>italic</em> and</strong> bold</em> I am <code>just</code> bold</strong></p>
\ No newline at end of file +<p><strong><em>I am <strong><em>italic</em> and</strong> bold</em> I am <code>just</code> bold</strong></p> +<p>Example <strong><em>bold italic</em></strong> on the same line <strong><em>bold italic</em></strong>.</p> +<p>Example <strong><em>bold italic</em></strong> on the same line <strong><em>bold italic</em></strong>.</p>
\ No newline at end of file diff --git a/tests/misc/nested-patterns.txt b/tests/misc/nested-patterns.txt index e347ccf..9032cf1 100644 --- a/tests/misc/nested-patterns.txt +++ b/tests/misc/nested-patterns.txt @@ -7,3 +7,7 @@ __[*link*](http://example.com)__ [***link***](http://example.com) ***I am ___italic_ and__ bold* I am `just` bold** + +Example __*bold italic*__ on the same line __*bold italic*__. + +Example **_bold italic_** on the same line **_bold italic_**. |