Repository navigation
Closed
Description
All are based on real input problems.
Version: d18e2fc
import markdown2
# Actual: <p><strong>x[<strong>y</strong>]</strong></p>
# Expected: <p><strong>x[</strong>y<strong>]</strong></p>
markdown_text = R"""
**x[**y**]**
"""
print(markdown2.markdown(markdown_text))
# Actual: <p>*A->*<strong>B</strong></p>
# Expected: <p><em>A-></em><strong>B</strong></p>
markdown_text = R"""
*A->***B**
"""
print(markdown2.markdown(markdown_text))
# Actual: <p>**A->**<strong>B</strong></p>
# Expected: <p><strong>A-></strong><strong>B</strong></p>
markdown_text = R"""
**A->****B**
"""
print(markdown2.markdown(markdown_text))
# Actual: <p><em><em>A</em> B_</em>C*</p>
# Expected: <p>*<em>A</em> B_<em>C*</em></p>
markdown_text = R"""
**A* B_*C*
"""
print(markdown2.markdown(markdown_text))
# Actual: <p>**A* B C_D. X Y Z *</p>
# Expected: <p>*<em>A</em> B C_D. X Y Z *</p>
markdown_text = R"""
**A* B C_D. X Y Z *
"""
print(markdown2.markdown(markdown_text))
# Actual: <p>**x.**y</p>
# Expected: <p><strong>x.</strong>y</p>
markdown_text = R"""
**x.**y
"""
print(markdown2.markdown(markdown_text, safe_mode='escape'))
# code-friendly should treat underscores as literal characters
#
# Actual: <p><strong>A</strong><em>B_C_D_E_F</em>G</p>
# Expected: <p>__A___B_C_D_E_F_G</p>
markdown_text = R"""
__A___B_C_D_E_F_G
"""
print(markdown2.markdown(markdown_text, extras={ 'code-friendly': None }))
# code-friendly should treat underscores as literal characters
#
# Actual: <p><strong>A_B</strong> <a href="https://example.com/">C<em>D</em>E</a></p>
# Expected: <p><strong>A_B</strong> <a href="https://example.com/">C_D_E</a></p>
markdown_text = R"""
**A_B** [C_D_E](https://example.com/)
"""
print(markdown2.markdown(markdown_text, extras={ 'code-friendly': None }))Metadata
Metadata
Assignees
Labels
No labels
Activity
Fix trentm#671
Fix trentm#671
Crozzers commentedon Feb 8, 2026
@justanotheranonymoususer I've pushed some changes to Crozzers/gfm-em-issue671 that fixes this. If you want to test that before I raise a PR and raise any extra issues with it.
Regarding that first example, that's actually valid GFM. From the rules:
x[**yis a left flanking delimiter run, not right flanking so in this instance nesting the<strong>is valid.Same issue with this example:
**x.**y. That second run is not a closing delimiter run and if you put it into Github's markdown preview it doesn't render it.Rest of them should be fixed though
Fix trentm#671
Crozzers commentedon Feb 12, 2026
Ok there are some redos issues with those fixes. I'll try and fix those as well
Merge pull request #678 from Crozzers/gfm-em-issue671