Skip to content

Fix whitespace collapsing between inline elements#108

Merged
xijo merged 1 commit intomasterfrom
fix-inline-newline-whitespace
Jan 20, 2026
Merged

Fix whitespace collapsing between inline elements#108
xijo merged 1 commit intomasterfrom
fix-inline-newline-whitespace

Conversation

@xijo
Copy link
Owner

@xijo xijo commented Jan 20, 2026

Summary

  • Preserve trailing newlines as spaces when there's following inline content
  • Properly handles HTML whitespace collapsing for cases like <span>A\n</span><span>B</span> → "A B"
  • Recursively traverses parent nodes to detect following content even in deeply nested inline elements

Test plan

  • Added specs for whitespace between inline elements
  • Added spec for nested inline elements (requires recursive parent traversal)
  • All 205 tests pass

Fixes #34

🤖 Generated with Claude Code

@xijo xijo force-pushed the fix-inline-newline-whitespace branch from c6375a1 to 5ef9367 Compare January 20, 2026 08:36
Preserve trailing newlines as spaces when there's following inline
content. This properly handles HTML whitespace collapsing for cases
like `<span>A\n</span><span>B</span>` which should render as "A B".

The fix recursively traverses parent nodes to detect following content
even when text is deeply nested inside inline elements.

Fixes #34

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@xijo xijo force-pushed the fix-inline-newline-whitespace branch from 5ef9367 to 9095ded Compare January 20, 2026 09:39
@xijo xijo merged commit 8bcbe56 into master Jan 20, 2026
7 checks passed
@xijo xijo deleted the fix-inline-newline-whitespace branch January 20, 2026 09:41
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.

Newlines whitespace is stripped instead of replaced by a single space

1 participant