Skip to content

Code span containing "<" inserts extra <p> #1073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dbader opened this issue Nov 21, 2020 · 2 comments
Closed

Code span containing "<" inserts extra <p> #1073

dbader opened this issue Nov 21, 2020 · 2 comments
Labels
duplicate The issue has been previously reported.

Comments

@dbader
Copy link
Contributor

dbader commented Nov 21, 2020

This works as expected:

>>> markdown.markdown("Para `X`\n\n<div>test</div>")
'<p>Para <code>X</code></p>\n<div>test</div>'

Adding a < inside the code span causes the <div> to be wrapped in a <p> element:

>>> markdown.markdown("Para `<X`\n\n<div>test</div>")
'<p>Para <code>&lt;X</code></p>\n<p><div>test</div></p>'

Doesn't happen with >:

>>> markdown.markdown("Para `>X`\n\n<div>test</div>")
'<p>Para <code>&gt;X</code></p>\n<div>test</div>'

Re-formatted examples:

Without <:

Para `X`
<div>test</div>
<p>Para <code>&lt;X</code></p>
<div>test</div>

With <:

Para `<X`
<div>test</div>
<p>Para <code>&lt;X</code></p>
<p><div>test</div></p>

👆 extra <p> element around the div

Versions

  • Happens on Markdown 3.3.3 and master (tested on 82ac905)
@dbader
Copy link
Contributor Author

dbader commented Nov 21, 2020

I think these might be fixed in #1072

Checking now.

@dbader
Copy link
Contributor Author

dbader commented Nov 21, 2020

Yep, all good in #1072:

>>> import markdown
>>> markdown.markdown("Para `X`\n\n<div>test</div>")
'<p>Para <code>X</code></p>\n<div>test</div>'
>>> markdown.markdown("Para `<X`\n\n<div>test</div>")
'<p>Para <code>&lt;X</code></p>\n<div>test</div>'
>>> markdown.markdown("Para `>X`\n\n<div>test</div>")
'<p>Para <code>&gt;X</code></p>\n<div>test</div>'

Thanks @waylan! Closing this issue.

@dbader dbader closed this as completed Nov 21, 2020
@waylan waylan added the duplicate The issue has been previously reported. label Nov 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate The issue has been previously reported.
Projects
None yet
Development

No branches or pull requests

2 participants