Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bug 1: List items being incorrectly nested if preceded by
\n\n
While processing
Item 2
,Item 4
would erroneously be flattened to the same level asItem 3
.In
_list_item_sub
if the last processed list item (in this caseItem 1
) ended with\n\n
, the current list item would be passed toself._outdent
, flattening the child list items.This bug was fixed by instead passing the current list item to
self._uniform_outdent
and outdenting it by 1-4 spaces.Bug 2: HTML blocks with
markdown="1"
not being processed correctly when inside list itemsThe
_list_item_sub
function assumes that most list items, if they don't contain\n\n
, should be run through the span gamut.This assumption causes the following markdown to be incorrectly converted:
List items are allowed to contain
div
blocks, which can contain other block elements such as headers. However, since this example does not contain\n\n
, it would be run through the span gamut and the header would not be processed.The fix for this was to add a dedicated
_do_markdown_in_html
function that piggy-backs off of_strict_tag_block_sub
.It will find and hash indented HTML blocks, resulting in the following markdown:
Due to the presence of
\n\n
, the_list_item_sub
will now process these correctly using the block gamut.Alternatives considered:
<li><p>some text</p></li>
_strict_tag_block_sub
to always hash indented HTML blocksOther notable changes
_uniform_indent
to give better control on what happens to whitespace-only lines_uniform_(in|out)dent
staticmethods and added docstrings