trentm / trentm/python-markdown2

HTML tags that are `display:block` by default are messed up when multiline

Open
#342 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
Python
Stars
2.8k
Forks
459
Avg merge
2d 19h
Merged PRs (30d)
4

Description

Certain HTML tags when messed up when multiline, and as far as I can tell it's the ones that are display:block by default.

Found on v2.3.6, installed from the FreeBSD py37-markdown2 port; I checked out the repo and ran v2.3.8 to make sure and it was not fixed.

Testcases (I use <wc> because I originally ran into this with a custom web component):


<wc>
<div>
</div>
</wc>

Produces (incorrect):

<p><wc></p>

<div>
</div>

<p></wc></p>

<wc>  
<pre>
</pre>
</wc>

Produces (incorrect):

<p><wc></p>

<pre>
</pre>

<p></wc></p>

<wc>
<h1>
</h1>
</wc>

Produces (incorrect):

<p><wc></p>

<h1>
</h1>

<p></wc></p>

<wc>
<span>
</span>
</wc>

Produces (correct):

<p><wc>
<span>
</span>
</wc></p>

<wc>
<invalid>
</invalid>
</wc>

Produces (correct):

<p><wc>
<invalid>
</invalid>
</wc></p>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the listed custom-element cases with the repository's markdown2 entry point, then trace how multiline HTML tags are classified and paragraph-wrapped. Done means block-level tags such as div, pre, and h1 remain inside the surrounding wc element, while span and invalid-tag behavior stays correct; add regression coverage for these examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.