Closed jackdewinter closed 1 month ago
This pull request implements changes to improve the handling of block quotes and lists in the pymarkdown project. The main focus is on refactoring the code to use a new LeadingSpaceIndexTracker class, which centralizes the logic for tracking container nesting and leading spaces. This change aims to fix issues related to MD027 and MD031 rules, particularly in complex nested structures.
sequenceDiagram
participant C as Client Code
participant T as LeadingSpaceIndexTracker
participant R as Rule (MD027/MD031)
C->>T: open_container(token)
C->>T: register_container_end(token)
C->>T: process_container_end(token)
T->>R: Update container information
R->>C: Apply rule based on updated container state
Change | Details | Files |
---|---|---|
Introduced LeadingSpaceIndexTracker class |
|
pymarkdown/plugins/utils/leading_space_index_tracker.py |
Refactored MD031 rule implementation |
|
pymarkdown/plugins/rule_md_031.py |
Updated MD027 rule to use LeadingSpaceIndexTracker |
|
pymarkdown/plugins/rule_md_027.py |
Adjusted block quote processing |
|
pymarkdown/block_quotes/block_quote_processor.py |
Updated tests and documentation |
|
test/rules/test_md031.py test/rules/test_md027.py newdocs/src/changelog.md |
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 100.00%. Comparing base (
e5fd5af
) to head (68c539c
). Report is 1 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
closes #1209
Summary by Sourcery
Refactor the handling of leading spaces in markdown containers by introducing a new utility class
LeadingSpaceIndexTracker
. Simplify the logic in markdown rule plugins by removing redundant code and consolidating methods. Update tests to reflect these changes and ensure comprehensive coverage. Document the changes in the changelog.Enhancements:
LeadingSpaceIndexTracker
to manage container stack and adjustments.rule_md_031.py
andrule_md_027.py
.Documentation:
Tests:
use_debug
flag from multiple test cases intest_md031.py
andtest_md027.py
, streamlining the test configurations.