Skip to content

Fix paragraph spacing#10

Merged
cpursley merged 2 commits into
mainfrom
fix-paragraph-spacing
Jul 20, 2025
Merged

Fix paragraph spacing#10
cpursley merged 2 commits into
mainfrom
fix-paragraph-spacing

Conversation

@cpursley

Copy link
Copy Markdown
Collaborator

No description provided.

cpursley added 2 commits July 20, 2025 09:41
This commit fixes issue #6 by removing excessive newlines that were
introduced in v0.2.1. The changes restore the clean output format
from v0.1.6 while maintaining all other improvements.

Breaking changes addressed:
- Remove leading/trailing newlines from paragraphs
- Remove wrapper newlines from headers, lists, and code blocks
- Maintain standard double newline (\n\n) spacing between block elements
- Add String.trim() to final output for clean results

Technical improvements:
- Implement smart spacing to avoid spaces before punctuation
- Fix BR tag handling to produce proper Markdown line breaks (two spaces + newline)
- Use placeholder approach for BR tags to preserve formatting through processing

The fix includes comprehensive test coverage with 15 new tests specifically
for paragraph spacing scenarios including edge cases like empty paragraphs,
BR tags, and mixed content types.
This release introduces significant architectural improvements to address
paragraph spacing issues and enhances the overall quality of Markdown output.

Changes:
- Fixed paragraph spacing within containers (resolves issue #6)
- Added context-aware processing with block vs inline element detection
- Introduced Html2Markdown.ElementTypes module for element classification
- Enhanced list formatting with proper line breaks between items
- Improved code block whitespace preservation using Base64 encoding workaround
- Better language detection for syntax-highlighted code blocks
- Streamlined processing logic for cleaner, more readable output

Breaking changes:
- Paragraph spacing now uses standard double newlines (\n\n) instead of
  single newline + space (\n \n) for better Markdown compliance
- More comprehensive content preservation (includes navigation elements)
@cpursley cpursley merged commit 691ad52 into main Jul 20, 2025
9 checks passed
@cpursley cpursley deleted the fix-paragraph-spacing branch July 20, 2025 15:23
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