@@ -112,7 +112,10 @@ def handle_starttag(self, tag, attrs):
112112 self .handle_empty_tag (data , True )
113113 return
114114
115- if tag in self .block_level_tags and (self .at_line_start () or self .intail ):
115+ if (
116+ tag in self .block_level_tags and
117+ (self .at_line_start () or self .intail or self .mdstarted and self .mdstarted [- 1 ])
118+ ):
116119 # Valueless attribute (ex: `<tag checked>`) results in `[('checked', None)]`.
117120 # Convert to `{'checked': 'checked'}`.
118121 attrs = {key : value if value is not None else key for key , value in attrs }
@@ -131,20 +134,6 @@ def handle_starttag(self, tag, attrs):
131134 attrs ['markdown' ] = state
132135 self .treebuilder .start (tag , attrs )
133136
134- elif not self .inraw and tag in self .block_level_tags and self .mdstarted and self .mdstarted [- 1 ]:
135- # Nested one-liner block tags `<tag><tag>...`
136- attrs = {key : value if value is not None else key for key , value in attrs }
137- state = self .get_state (tag , attrs )
138- if 'p' in self .mdstack and tag in self .block_level_tags :
139- # Close unclosed 'p' tag
140- self .handle_endtag ('p' )
141- self .mdstate .append (state )
142- self .mdstack .append (tag )
143- self .mdstarted .append (True )
144- attrs ['markdown' ] = state
145- self .treebuilder .start (tag , attrs )
146- return
147-
148137 else :
149138 # Span level tag
150139 if self .inraw :
0 commit comments