Skip to content
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

InlineHTML <center> not treated as HTML correctly #1481

Open
ScriptPup opened this issue Sep 18, 2024 · 2 comments
Open

InlineHTML <center> not treated as HTML correctly #1481

ScriptPup opened this issue Sep 18, 2024 · 2 comments
Labels
needs-decision A decision needs to be made regarding request.

Comments

@ScriptPup
Copy link

If <center> has tags nested underneath it, the <center> tag is surrounded by <p> tags, breaking the HTML.

from markdown import markdown
text = """# My Header

<center>
Test
</center>

<center>
<div>Something</div>
</center>

<div>
Test div
</div>

<div>
<p>Some paragraph</p>
</div>

<div>
<article>Some paragraph</article>
</div>

Something else
"""
print(markdown(text))

Results in:

image

It seems like

works correctly, so not 100% why the difference.

@facelessuser
Copy link
Collaborator

<center> should be treated as a block element (not wrapped in <p>). It's currently being treated as an inline element. It should also be noted that <center> is also a deprecated element that should not be used. With that said, since it is being used, maybe we should update the block element list to account for <center>.

@waylan
Copy link
Member

waylan commented Sep 19, 2024

Our behavior matches exactly the reference implementation (markdown.pl). Specifically, we treat <center> as an inline tag because the reference implementation does. As the tag is deprecated, I'm inclined to not make any changes.

@waylan waylan added the needs-decision A decision needs to be made regarding request. label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-decision A decision needs to be made regarding request.
Projects
None yet
Development

No branches or pull requests

3 participants