Skip to content

Commit

Permalink
https://github.com/jackdewinter/pymarkdown/issues/964
Browse files Browse the repository at this point in the history
  • Loading branch information
jackdewinter committed Jan 28, 2024
1 parent 5962228 commit 23b4d93
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
- inconsistent splitting of whitespace caused some issues
- went through all strip() calls and ensured that they have the
specific type of whitespace identified and documented
- [Issue 964](https://github.com/jackdewinter/pymarkdown/issues/964)
- final fix states needed verification and fixing of any issues
- uncovered and fixed issues in Md007, Md019, and Md029

### Changed

Expand Down
4 changes: 2 additions & 2 deletions publish/coverage.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"totalCovered": 4795
},
"lineLevel": {
"totalMeasured": 19342,
"totalCovered": 19342
"totalMeasured": 19341,
"totalCovered": 19341
}
}

10 changes: 7 additions & 3 deletions pymarkdown/plugins/rule_md_007.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,15 @@ def __check_apply_fix(
calculated_column_number: int,
) -> None:
list_token = cast(ListStartMarkdownToken, token)

# column_delta is the space before the list start and follow_space_delta
# is the space following the list start, before the list text commences.
column_delta = adjusted_column_number - calculated_column_number
whitespace_length = len(list_token.extracted_whitespace)
assert whitespace_length >= column_delta
adjusted_whitespace = list_token.extracted_whitespace[:-column_delta]
follow_space_delta = (list_token.indent_level - list_token.column_number) - 1

assert len(list_token.extracted_whitespace) >= column_delta
adjusted_whitespace = list_token.extracted_whitespace[:-column_delta]

self.register_fix_token_request(
context,
token,
Expand Down

0 comments on commit 23b4d93

Please sign in to comment.