Skip to content

Multiple regressions since #665 #671

@justanotheranonymoususer

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions