Skip to content

Keep a paragraph's space after clear of the footnote separator (#1116) - #1140

Merged
echelon merged 3 commits into
storytold:mainfrom
dkhlapov:issue-1116-footnote-space-after
Oct 14, 2026
Merged

echelon merged 3 commits into
storytold:mainfrom
dkhlapov:issue-1116-footnote-space-after

Conversation

@dkhlapov

@dkhlapov dkhlapov commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

#1116: keep a paragraph's space after clear of the footnote separator

Fixes #1116. On a page with footnotes, a paragraph that ends there now keeps its space after above the footnote separator. When the space after doesn't fit, the last line goes to the next page with its note (with widow control, one more line goes too), as in Word.

  • Contextual spacing and automatic spacing between list items drop the requirement.
  • Pages without notes are unchanged: space after may still run past the bottom margin.
  • The rule also applies to the document's last paragraph. That case hasn't been checked against Word.

Tests:

  • space_after_stays_clear_of_the_footnote_separator sweeps a paragraph with 6 pt space after, and a footnote on its last line, down the page 1 pt at a time. It fails on main.
  • space_after_may_overflow_the_bottom_margin_without_notes checks that pages without notes are unchanged.
  • cargo xtask ci passes.

🤖 Generated with Claude Code

…separator

On a page with footnotes (already there or brought by the line), a
paragraph's last line only fits if its space after fits above the notes
area too; otherwise it goes to the next page with its note (and, with
widow control, one more line). Contextual spacing and automatic spacing
between list items drop the requirement; pages without notes are
unchanged (space after may still run past the bottom margin).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dkhlapov
dkhlapov force-pushed the issue-1116-footnote-space-after branch from 82bc55b to 206654c Compare October 12, 2026 23:50
@dkhlapov dkhlapov changed the title WIP: Layout: a paragraph ending above footnotes needs its space after clear of the separator (pagination drifts from Word) (#1116) Keep a paragraph's space after clear of the footnote separator (#1116) Oct 12, 2026
@dkhlapov
dkhlapov marked this pull request as ready for review October 12, 2026 23:50
…de's tests, only on pages with notes

Contextual spacing drops a paragraph's space after only when that paragraph
asks for it, and the next paragraph counts as a list item only when it gets
a label (Numbering::shows_label), as in the spacing between paragraphs.
The kept space after is worked out only for a last line on a page with notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dkhlapov

Copy link
Copy Markdown
Contributor Author

Review follow-ups (7710fc7):

  • Same tests as the spacing code: space_after_kept now uses the same contextual-spacing and "next paragraph gets a label" tests the spacing code uses.
  • Computed only when needed: it's worked out only for a paragraph's last line on a page with notes.
  • Tests: space_after_stays_clear_when_only_the_next_paragraph_has_contextual_spacing and space_after_stays_clear_before_a_numbered_paragraph_without_a_label.

Full CI passed.

# Conflicts:
#	ROADMAP.md
#	docs/layout-parity.md
@echelon
echelon merged commit 85a3a53 into storytold:main Oct 14, 2026
@echelon

echelon commented Oct 14, 2026

Copy link
Copy Markdown
Member

Thanks for the contribution, @dkhlapov! This has landed in main. If you haven't already, come join us on Discord: https://discord.gg/artcraft

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.

Layout: a paragraph ending above footnotes needs its space after clear of the separator (pagination drifts from Word)

2 participants