Skip to content

Pagination: ignore empty spacer <p> and apply its hide mutation in deferred Preview queue#198

Merged
mettta merged 4 commits intomainfrom
ghost_paragraph
Feb 18, 2026
Merged

Pagination: ignore empty spacer <p> and apply its hide mutation in deferred Preview queue#198
mettta merged 4 commits intomainfrom
ghost_paragraph

Conversation

@mettta
Copy link
Copy Markdown
Owner

@mettta mettta commented Feb 18, 2026

This PR combines the empty-spacer paragraph fix with a minimal deferred mutation pipeline.

Problem:
User-generated HTML may contain empty spacer

nodes. When such a paragraph becomes a page-start candidate near forced breaks, pagination can produce an unjustified blank page.

Solution:

  1. Empty spacer paragraph handling:
  • Added a dedicated structural predicate for ignorable spacer paragraphs.
  • During page-start registration, such paragraphs are skipped as page-start candidates.
  1. Deferred mutation pipeline:
  • Added a lightweight mutation queue.
  • Added mutation commands, including hide-ignorable-spacer-paragraph.
  • Pages now registers the spacer hide as a deferred mutation instead of mutating DOM immediately.
  • Preview flushes deferred mutations at create-time.

Result:

  • The empty spacer <p> case is handled safely.
  • DOM writes for this case are now deferred to the Preview stage, reducing immediate layout-impacting mutations during pagination calculations.

@mettta mettta merged commit 390a55e into main Feb 18, 2026
5 checks passed
@mettta mettta deleted the ghost_paragraph branch February 18, 2026 16:49
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