Repository: jackdewinter/pymarkdown

Issue:
List Item spacing off (markdown regen)
SKIPPED [1] test\test_markdown_extra.py:2573: unconditional skip
SKIPPED [1] test\test_markdown_extra.py:2668: unconditional skip
SKIPPED [1] test\test_markdown_extra.py:2853: unconditional skip
SKIPPED [1] test\test_markdown_extra.py:2901: unconditional skip
SKIPPED [1] test\test_markdown_extra.py:3070: unconditional skip
SKIPPED [1] test\test_markdown_extra.py:3114: unconditional skip
SKIPPED [1] test\test_markdown_extra.py:3158: unconditional skip

Discussion:

Patch:
diff --git a/changelog.md b/changelog.md
index 3328febc..c272bcce 100644
--- a/changelog.md
+++ b/changelog.md
@@ -8,6 +8,9 @@
 
 ### Fixed
 
+- [Issue 828](https://github.com/jackdewinter/pymarkdown/issues/828)
+  - list new items within block quotes were not always rendering properly
+    in Markdown, required changes to markdown regen
 - [Issue 829](https://github.com/jackdewinter/pymarkdown/issues/829)
   - fixed issue with BlockQuoteData instance not being passed back
     properly.  as a result, one closing of a block quote was not noticed
diff --git a/publish/pylint_suppression.json b/publish/pylint_suppression.json
index a1d722b9..dd5e521c 100644
--- a/publish/pylint_suppression.json
+++ b/publish/pylint_suppression.json
@@ -461,8 +461,7 @@
             "too-many-boolean-expressions": 1
         },
         "pymarkdown/transform_markdown/transform_list_block.py": {
-            "too-many-arguments": 3,
-            "too-many-locals": 1
+            "too-many-arguments": 2
         },
         "pymarkdown/transform_markdown/transform_new_list_item.py": {
             "too-few-public-methods": 1,
@@ -477,8 +476,8 @@
         "too-many-instance-attributes": 23,
         "too-many-public-methods": 4,
         "too-few-public-methods": 40,
-        "too-many-arguments": 206,
-        "too-many-locals": 27,
+        "too-many-arguments": 205,
+        "too-many-locals": 26,
         "chained-comparison": 1,
         "too-many-boolean-expressions": 2,
         "protected-access": 23,
diff --git a/pymarkdown/transform_markdown/transform_list_block.py b/pymarkdown/transform_markdown/transform_list_block.py
index 557f8dbe..17bd3cea 100644
--- a/pymarkdown/transform_markdown/transform_list_block.py
+++ b/pymarkdown/transform_markdown/transform_list_block.py
@@ -56,7 +56,6 @@ class TransformListBlock:
                 context,
                 current_list_token,
                 previous_token,
-                next_token,
                 extracted_whitespace,
             )
             POGGER.debug(f">>extracted_whitespace>>{extracted_whitespace}<<")
@@ -173,7 +172,6 @@ class TransformListBlock:
         context: MarkdownTransformContext,
         current_token: Union[ListStartMarkdownToken, NewListItemMarkdownToken],
         previous_token: MarkdownToken,
-        next_token: MarkdownToken,
         extracted_whitespace: str,
     ) -> Tuple[int, str, bool, Optional[str], bool, bool]:
         """
@@ -235,7 +233,6 @@ class TransformListBlock:
                 deeper_containing_block_quote_token,
                 extracted_whitespace,
                 previous_token,
-                next_token,
             )
 
         POGGER.debug(f"xx>>previous_indent:{previous_indent}:")
@@ -387,7 +384,6 @@ class TransformListBlock:
 
         return True, previous_indent
 
-    # pylint: disable=too-many-arguments, too-many-locals
     @staticmethod
     def __rehydrate_list_start_contained_in_list(
         current_token: Union[ListStartMarkdownToken, NewListItemMarkdownToken],
@@ -395,7 +391,6 @@ class TransformListBlock:
         deeper_containing_block_quote_token: Optional[BlockQuoteMarkdownToken],
         extracted_whitespace: str,
         previous_token: MarkdownToken,
-        next_token: MarkdownToken,
     ) -> Tuple[int, str, str, bool, bool]:
         # POGGER.debug(
         #     f"adj->containing_list_token>>:{ParserHelper.make_value_visible(containing_list_token)}:<<"
@@ -418,7 +413,6 @@ class TransformListBlock:
         )
 
         list_start_content_length = 0
-        add_extracted_whitespace_at_end = False
         # POGGER.debug(
         #     f"previous_token-->{ParserHelper.make_value_visible(previous_token)}"
         # )
@@ -438,7 +432,6 @@ class TransformListBlock:
                     if new_list_token.is_ordered_list_start
                     else 0
                 )
-                add_extracted_whitespace_at_end = not next_token.is_block_quote_start
 
         post_adjust_whitespace = TransformListBlock.__calculate_post_adjust_whitespace(
             starting_whitespace,
@@ -446,7 +439,6 @@ class TransformListBlock:
             block_quote_leading_space_length,
             list_leading_space_length,
             list_start_content_length,
-            add_extracted_whitespace_at_end,
             current_token,
         )
 
@@ -465,8 +457,6 @@ class TransformListBlock:
             had_weird_block_quote_in_list,
         )
 
-    # pylint: enable=too-many-arguments, too-many-locals
-
     @staticmethod
     def __look_for_last_block_token(
         context: MarkdownTransformContext,
@@ -558,7 +548,6 @@ class TransformListBlock:
         block_quote_leading_space_length: int,
         list_leading_space_length: int,
         list_start_content_length: int,
-        add_extracted_whitespace_at_end: bool,
         current_token: Union[ListStartMarkdownToken, NewListItemMarkdownToken],
     ) -> str:
         POGGER.debug(f"adj->starting_whitespace>>:{starting_whitespace}:<<")
@@ -571,19 +560,19 @@ class TransformListBlock:
         POGGER.debug(f"adj->list_leading_space_length>>:{list_leading_space_length}:<<")
         POGGER.debug(f"list_start_content_length:{list_start_content_length}:<<")
 
-        pad_to_length = (
-            containing_list_token.indent_level
-            - block_quote_leading_space_length
-            - list_leading_space_length
-            - list_start_content_length
-        )
+        if current_token.is_new_list_item:
+            pad_to_length = current_token.column_number - 1
+        else:
+            pad_to_length = (
+                containing_list_token.indent_level
+                - block_quote_leading_space_length
+                - list_leading_space_length
+                - list_start_content_length
+            )
         POGGER.debug(f"pad_to_length:{pad_to_length}:<<")
         POGGER.debug(f"adj->starting_whitespace>>:{starting_whitespace}:<<")
         post_adjust_whitespace = starting_whitespace.ljust(pad_to_length, " ")
         POGGER.debug(f"adj->post_adjust_whitespace>>:{post_adjust_whitespace}:<<")
-        if add_extracted_whitespace_at_end:
-            post_adjust_whitespace += current_token.extracted_whitespace
-        POGGER.debug(f"adj->post_adjust_whitespace>>:{post_adjust_whitespace}:<<")
         return post_adjust_whitespace
 
     # pylint: enable=too-many-arguments
diff --git a/pymarkdown/transform_markdown/transform_new_list_item.py b/pymarkdown/transform_markdown/transform_new_list_item.py
index 672e2e7c..d1b78cfd 100644
--- a/pymarkdown/transform_markdown/transform_new_list_item.py
+++ b/pymarkdown/transform_markdown/transform_new_list_item.py
@@ -70,7 +70,6 @@ class TransformNewListItem:
             context,
             current_list_token,
             previous_token,
-            next_token,
             extracted_whitespace,
         )
         # else:


Test patch:
diff --git a/publish/test-results.json b/publish/test-results.json
index 423b3bd6..85824b26 100644
--- a/publish/test-results.json
+++ b/publish/test-results.json
@@ -1631,7 +1631,7 @@
             "totalTests": 108,
             "failedTests": 0,
             "errorTests": 0,
-            "skippedTests": 7,
+            "skippedTests": 0,
             "elapsedTimeInMilliseconds": 0
         },
         {
diff --git a/test/test_markdown_extra.py b/test/test_markdown_extra.py
index 170378ac..bce99bfb 100644
--- a/test/test_markdown_extra.py
+++ b/test/test_markdown_extra.py
@@ -2571,7 +2571,6 @@ def test_extra_024a():
 
 
 @pytest.mark.gfm
-@pytest.mark.skip
 def test_extra_025xx():
     """
     TBD
@@ -2666,7 +2665,6 @@ that</p>
 
 
 @pytest.mark.gfm
-@pytest.mark.skip
 def test_extra_025ax():
     """
     TBD
@@ -2851,7 +2849,6 @@ that</p>
 
 
 @pytest.mark.gfm
-@pytest.mark.skip
 def test_extra_025cxx():
     """
     TBD
@@ -2899,7 +2896,6 @@ item</p>
 
 
 @pytest.mark.gfm
-@pytest.mark.skip
 def test_extra_025cxb():
     """
     TBD
@@ -3068,7 +3064,6 @@ def test_extra_025cxe():
 
 
 @pytest.mark.gfm
-@pytest.mark.skip
 def test_extra_025cxf():
     """
     TBD
@@ -3112,7 +3107,6 @@ is</p>
 
 
 @pytest.mark.gfm
-@pytest.mark.skip
 def test_extra_025cxg():
     """
     TBD
@@ -3156,7 +3150,6 @@ is</p>
 
 
 @pytest.mark.gfm
-@pytest.mark.skip
 def test_extra_025cxz():
     """
     Verify that a nesting of block quote, ordered list, block quote, with
@@ -3194,7 +3187,7 @@ def test_extra_025cxz():
 </blockquote>"""
 
     # Act & Assert
-    act_and_assert(source_markdown, expected_gfm, expected_tokens)
+    act_and_assert(source_markdown, expected_gfm, expected_tokens, show_debug=False)
 
 
 @pytest.mark.gfm