Skip to content

Improve handling for leading underscores #642

@justanotheranonymoususer

Description

Describe the bug
Consider this:

_confusing ident is _confusing

Both GitHub and markdown2 don't treat the underscores as <em>.

But for this, markdown2 treats underscores as em, unlike GitHub:

**_confusing** ident is **_confusing**

To Reproduce

import markdown2

markdown_text = """
**_confusing** ident is **_confusing**
"""

html_output = markdown2.markdown(markdown_text)

print(html_output)

Expected behavior
Expected:

<p><strong>_confusing</strong> ident is <strong>_confusing</strong></p>

Actual:

<p><strong><em>confusing</strong> ident is <strong></em>confusing</strong></p>

Debug info
Version of library being used: 8d50892

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions