Skip to content

https://github.com/jackdewinter/pymarkdown/issues/1706 - #1738

Merged
jackdewinter merged 2 commits into
mainfrom
issue-1673
Nov 8, 2026
Merged

jackdewinter merged 2 commits into
mainfrom
issue-1673

Conversation

@jackdewinter

@jackdewinter jackdewinter commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Summary by Sourcery

Fix Md031 automatic formatting so fenced code blocks receive the correct surrounding blank lines without corrupting nested list structure.

Bug Fixes:

  • Correct Rule Md031 fix-mode handling for fenced code blocks in nested lists, block quotes, and consecutive list structures.

Enhancements:

  • Improve blank-line insertion and container-spacing adjustments while applying Md031 fixes.

Documentation:

  • Document the resolution of issue 1706 in the changelog.

Tests:

  • Add comprehensive regression coverage for Md031 fixes across list, block quote, thematic-break, heading, and truncated-document scenarios.

@sourcery-ai

sourcery-ai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Implementation

Adjust MD031’s container-spacing calculations and token tracking to fix blank-line placement during auto-fixes.

  • pymarkdown/plugins/rule_md_031.py L787-793, L799-808, L815-819 (+13 small edits)

Documentation

Record the MD031 fix for issue 1706 in the changelog.

  • newdocs/src/changelog.md L27-28

Tests

Update affected MD031 regression cases and add coverage for fenced blocks across sequential and nested lists, block quotes, and intervening elements.

  • test/rules/test_md031.py L9453-9904 (+9 small edits)

Other changes

Files not grouped.

  • publish/coverage.json L5-10
  • publish/test-results.json L1375-1378

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Coverage

Coverage Report
FileStmtsMissBranchBrPartCoverMissing
__init__.py1000100% 
__main__.py3000100% 
api.py3300600100% 
application_configuration_helper.py21040100% 
application_logging.py850160100% 
file_scan_helper.py53601800100% 
main.py1840340100% 
my_application_properties_facade.py23000100% 
return_code_helper.py65060100% 
version.py3000100% 
version_helper.py33020100% 
block_quotes
   __init__.py0000100% 
   block_quote_count_helper.py2980760100% 
   block_quote_data.py7000100% 
   block_quote_non_fenced_helper.py2410700100% 
   block_quote_processor.py2990600100% 
coalesce
   __init__.py0000100% 
   coalesce_processor.py640240100% 
container_blocks
   __init__.py0000100% 
   container_block_leaf_processor.py62001560100% 
   container_block_nested_processor.py2290560100% 
   container_block_non_leaf_processor.py34501060100% 
   container_block_processor.py1840500100% 
   container_grab_bag.py3650540100% 
   container_helper.py990240100% 
   container_indices.py8000100% 
   parse_block_pass_properties.py28020100% 
extension_manager
   __init__.py0000100% 
   extension_impl.py12000100% 
   extension_manager.py1750340100% 
   extension_manager_constants.py3000100% 
   parser_extension.py10000100% 
extensions
   __init__.py0000100% 
   disallowed_raw_html.py370120100% 
   extended_autolinks.py2600820100% 
   extension_one.py19040100% 
   extension_token_types.py9000100% 
   front_matter_extension.py910180100% 
   front_matter_markdown_token.py60000100% 
   markdown_strikethrough.py10000100% 
   markdown_tables.py10000100% 
   pragma_token.py1820520100% 
   task_list_items.py52040100% 
general
   __init__.py0000100% 
   bad_tokenization_error.py3000100% 
   constants.py38000100% 
   main_presentation.py24060100% 
   parser_helper.py4220980100% 
   parser_logger.py670220100% 
   parser_state.py1790380100% 
   position_marker.py7000100% 
   requeue_line_info.py8000100% 
   source_providers.py500120100% 
   tab_helper.py2820640100% 
   tokenized_markdown.py49501280100% 
html_helpers
   __init__.py0000100% 
   html_helper.py33801220100% 
   html_raw_helper.py1450620100% 
inline
   __init__.py0000100% 
   emphasis_helper.py2140780100% 
   inline_autolink_helper.py710200100% 
   inline_backslash_helper.py490100100% 
   inline_backtick_helper.py2220500100% 
   inline_character_reference_helper.py1190180100% 
   inline_handler_helper.py3340760100% 
   inline_helper.py1200280100% 
   inline_line_end_helper.py1500340100% 
   inline_processor.py2020540100% 
   inline_request.py23000100% 
   inline_response.py15000100% 
   inline_tabified_text_block_helper.py940140100% 
   inline_text_block_helper.py2390640100% 
leaf_blocks
   __init__.py0000100% 
   atx_leaf_block_processor.py1670380100% 
   fenced_leaf_block_processor.py3970820100% 
   indented_leaf_block_processor.py2430480100% 
   leaf_block_helper.py2130580100% 
   leaf_block_processor.py670140100% 
   leaf_block_processor_paragraph.py1900360100% 
   setext_leaf_block_processor.py1000140100% 
   table_block_continuation_helper.py2980640100% 
   table_block_parse_helper.py1670640100% 
   table_block_processor.py1780360100% 
   table_block_tuple.py30000100% 
   thematic_leaf_block_processor.py1310380100% 
links
   __init__.py0000100% 
   link_create_helper.py1220260100% 
   link_helper_properties.py27000100% 
   link_parse_helper.py3870920100% 
   link_reference_definition_continuation_helper.py2340540100% 
   link_reference_definition_helper.py1810360100% 
   link_reference_definition_parse_helper.py810240100% 
   link_reference_info.py10000100% 
   link_reference_titles.py6000100% 
   link_reference_tuple.py9000100% 
   link_search_helper.py2360600100% 
list_blocks
   __init__.py0000100% 
   list_block_can_close_helper.py720180100% 
   list_block_create_new_handler.py3100580100% 
   list_block_pre_list_helper.py1080200100% 
   list_block_processor.py3160580100% 
   list_block_starts_helper.py1550420100% 
plugin_manager
   __init__.py0000100% 
   bad_plugin_error.py390180100% 
   bad_plugin_fix_error.py3000100% 
   fix_line_record.py6000100% 
   fix_token_record.py10000100% 
   found_plugin.py18000100% 
   plugin_details.py36000100% 
   plugin_manager.py56302460100% 
   plugin_modify_context.py6000100% 
   plugin_scan_context.py1370380100% 
   plugin_scan_failure.py18040100% 
   replace_tokens_record.py9000100% 
   rule_plugin.py67040100% 
plugins
   __init__.py0000100% 
   plugin_one.py41060100% 
   rule_md_001.py410160100% 
   rule_md_002.py33080100% 
   rule_md_003.py770220100% 
   rule_md_004.py660260100% 
   rule_md_005.py32201000100% 
   rule_md_006.py530240100% 
   rule_md_007.py1050400100% 
   rule_md_009.py1010360100% 
   rule_md_010.py660180100% 
   rule_md_011.py39080100% 
   rule_md_012.py1290460100% 
   rule_md_013.py790200100% 
   rule_md_014.py310100100% 
   rule_md_018.py1160340100% 
   rule_md_019.py410180100% 
   rule_md_020.py420120100% 
   rule_md_021.py720280100% 
   rule_md_022.py800300100% 
   rule_md_023.py1550660100% 
   rule_md_024.py640180100% 
   rule_md_025.py440160100% 
   rule_md_026.py510180100% 
   rule_md_027.py58102280100% 
   rule_md_028.py400160100% 
   rule_md_029.py1070440100% 
   rule_md_030.py1060400100% 
   rule_md_031.py58801800100% 
   rule_md_032.py790300100% 
   rule_md_033.py700260100% 
   rule_md_034.py480220100% 
   rule_md_035.py570320100% 
   rule_md_036.py640160100% 
   rule_md_037.py1300460100% 
   rule_md_038.py290140100% 
   rule_md_039.py300160100% 
   rule_md_040.py15040100% 
   rule_md_041.py890340100% 
   rule_md_042.py16040100% 
   rule_md_043.py2010860100% 
   rule_md_044.py2230900100% 
   rule_md_045.py15040100% 
   rule_md_046.py960260100% 
   rule_md_047.py26080100% 
   rule_md_048.py420120100% 
   rule_md_049.py430140100% 
   rule_md_050.py430140100% 
   rule_md_051.py1860660100% 
   rule_md_053.py670260100% 
   rule_md_054.py510180100% 
   rule_md_055.py870260100% 
   rule_md_056.py350120100% 
   rule_md_058.py390140100% 
   rule_md_059.py360120100% 
   rule_md_060.py47401480100% 
   rule_pml_100.py1000400100% 
   rule_pml_101.py620180100% 
   rule_pml_102.py670180100% 
plugins/utils
   __init__.py0000100% 
   container_token_manager.py1050420100% 
   leading_space_index_tracker.py1240300100% 
   list_tracker.py1010180100% 
tokens
   __init__.py0000100% 
   atx_heading_markdown_token.py820100100% 
   blank_line_markdown_token.py38040100% 
   block_quote_markdown_token.py1240220100% 
   container_markdown_token.py9000100% 
   email_autolink_markdown_token.py46020100% 
   emphasis_markdown_token.py63080100% 
   end_of_stream_token.py27000100% 
   fenced_code_block_markdown_token.py1480280100% 
   hard_break_markdown_token.py41020100% 
   html_block_markdown_token.py60080100% 
   html_items.py92040100% 
   image_start_markdown_token.py54040100% 
   indented_code_block_markdown_token.py770100100% 
   inline_code_span_markdown_token.py850120100% 
   inline_markdown_token.py9000100% 
   leaf_markdown_token.py17020100% 
   link_reference_definition_markdown_token.py1210160100% 
   link_start_markdown_token.py990180100% 
   list_start_markdown_token.py1070200100% 
   list_start_markdown_token_helper.py46080100% 
   markdown_token.py3490300100% 
   new_list_item_markdown_token.py650100100% 
   ordered_list_start_markdown_token.py15000100% 
   paragraph_markdown_token.py930140100% 
   raw_html_markdown_token.py58060100% 
   reference_markdown_token.py94080100% 
   setext_heading_markdown_token.py1040120100% 
   special_text_markdown_token.py28020100% 
   stack_token.py213000100% 
   table_markdown_tokens.py3850280100% 
   text_markdown_token.py2980680100% 
   thematic_break_markdown_token.py62080100% 
   token_types.py42000100% 
   unordered_list_start_markdown_token.py15000100% 
   uri_autolink_markdown_token.py640100100% 
transform_gfm
   __init__.py0000100% 
   transform_state.py89000100% 
   transform_to_gfm.py870200100% 
   transform_to_gfm_list_looseness.py2090760100% 
   transform_to_gfm_token_handlers.py55080100% 
transform_markdown
   __init__.py0000100% 
   markdown_transform_context.py26000100% 
   transform_block_quote.py1110260100% 
   transform_containers.py75502460100% 
   transform_list_block.py2870440100% 
   transform_new_list_item.py1000160100% 
   transform_to_markdown.py1440360100% 
TOTAL25471064340100% 

Test Execution

Tests Skipped Failures Errors Time
10377 43 💤 0 ❌ 0 🔥 5m 0s ⏱️

@codecov

codecov Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (8f846ba) to head (807872e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1738   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          209       209           
  Lines        25461     25471   +10     
  Branches      3214      3217    +3     
=========================================
+ Hits         25461     25471   +10     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jackdewinter
jackdewinter merged commit 178dd4f into main Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant