Skip to content

feat: paged-media CSS generation for running footers - #581

Merged
transitrix merged 2 commits into
mainfrom
methodology/538-running-footer-paged-media
Sep 2, 2026
Merged

transitrix merged 2 commits into
mainfrom
methodology/538-running-footer-paged-media

Conversation

@transitrix

@transitrix transitrix commented Sep 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds running-footer paged-media CSS: issuer, date, document identity, and page number on every page.

What's new

New module: packages/document-renderer/src/render-vivliostyle.mjs (dependency-free)

  • generatePagedMediaCss(metadata) — generates CSS with:

    • @page rule for A4 (595 × 842 pt) with 20mm margins
    • @bottom-center running footer showing issuer, date, identity, commit, page number
    • @page :first suppression (title page has no footer)
    • @page landscape for wide diagrams (A4 rotated: 842 × 595 pt)
    • Typography rules (headings, paragraphs, lists, code, tables)
    • Page-break avoidance rules for headings and figures
  • wrapHtmlForPrintRendering(html, metadata) — returns complete HTML document with embedded CSS

New tests: packages/document-renderer/tests/test_paged_media_css.mjs

  • 30 test cases verifying CSS generation, escaping, footer content, page rules
  • All passing

Spec update: packages/document-renderer/PDF_RENDERING_ENGINE.md

  • Documents the new CSS generation module
  • Shows how to integrate with Vivliostyle or other CSS Paged Media engines
  • Updates decision record

Architecture

  • This package (document-renderer) stays dependency-free
  • Paged-media CSS generation is factored into this module (no external libraries)
  • Actual PDF rendering via Vivliostyle/other engine happens in caller's pipeline (e.g., documents-cli)
  • Interface: caller receives HTML + embedded CSS → passes to renderer → gets PDF

Next steps

  • Diagrams on page: embed diagram content, bind to snapshot date
  • Landscape pages: detect wide views, apply landscape page rule
  • Integration in documents-cli: wire Vivliostyle call with generated HTML + CSS

Testing

cd packages/document-renderer
node tests/test_paged_media_css.mjs

…ning footers

Add render-vivliostyle.mjs (dependency-free) with:
- generatePagedMediaCss() for @page rules with running footer
- wrapHtmlForPrintRendering() to embed CSS in HTML
- Support for issuer, date, identity, page number in footer
- Landscape pages for wide diagrams, typography rules, page breaks

Implements the paged-media CSS generation specified in
PDF_RENDERING_ENGINE.md. All tests pass; ready for Vivliostyle
integration in the document rendering pipeline.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@transitrix
transitrix force-pushed the methodology/538-running-footer-paged-media branch from 184900d to 5893cb8 Compare September 2, 2026 18:40
…atus lines

Signed-off-by: transitrix <automation@transitrix.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@transitrix transitrix changed the title feat: paged-media CSS generation for running footers (epic #505, part 2) feat: paged-media CSS generation for running footers Sep 2, 2026
@transitrix
transitrix merged commit 4089bf4 into main Sep 2, 2026
11 checks passed
@transitrix
transitrix deleted the methodology/538-running-footer-paged-media branch September 2, 2026 19:05
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