Skip to content

Commit

Permalink
More consistent newline handling in blocks extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
facelessuser committed Dec 22, 2024
1 parent 9e26f64 commit 34a2594
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/src/markdown/about/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- **FIX**: Snippets: Properly capture empty newline at end of file.
- **FIX**: Snippets: Fix issue where when non sections of files are included, section labels are not stripped.
- **FIX**: BetterEm: Fixes for complex cases.
- **FIX**: Blocks: More consistent handling of empty newlines in block processor extensions.

## 10.12

Expand Down
4 changes: 2 additions & 2 deletions pymdownx/blocks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,10 @@ def parse_blocks(self, blocks, entry):
if is_atomic or not is_block:
child = list(target)[-1] if len(target) else None
text = target.text if child is None else child.tail
b = '\n\n'.join(unescape_markdown(self.md, [b], is_atomic))
b = '\n\n'.join(unescape_markdown(self.md, [b], is_atomic)).strip('\n')

if text:
text += '\n\n' + b
text += b if not b else '\n\n' + b
else:
text = b

Expand Down
2 changes: 0 additions & 2 deletions tests/test_extensions/test_blocks/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,6 @@ def test_inline_and_md_in_html(self):
**content**
</div>
<strong>content</strong></div>
''',
True
Expand Down

0 comments on commit 34a2594

Please sign in to comment.