Skip to content

feat(document-renderer): figure caption formatting with snapshot dates - #583

Merged
transitrix merged 1 commit into
mainfrom
methodology/539-diagram-captions-snapshots
Sep 4, 2026
Merged

transitrix merged 1 commit into
mainfrom
methodology/539-diagram-captions-snapshots

Conversation

@transitrix

@transitrix transitrix commented Sep 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

Implement figure caption formatting with snapshot build dates, enabling diagrams embedded in PDFs to be traced back to their source snapshots and build time.

What's included

  • formatFigureCaptions() function to process HTML figure elements
  • Figures with data-snapshot-id attributes now display captions with formatted snapshot dates
  • CSS rules for figure styling in paged-media context
  • Comprehensive test suite for caption formatting

How it works

Figures reference snapshots via data-snapshot-id:

<figure data-snapshot-id="snap-001">
  <img src="diagram.svg" />
  <figcaption>System Architecture</figcaption>
</figure>

When metadata includes snapshots:

const metadata = {
  snapshots: {
    'snap-001': { generated_at: '2026-09-02T14:45:00Z' }
  }
};

const html = wrapHtmlForPrintRendering(content, metadata);
// Caption now reads: "System Architecture (Sep 2, 2026)"

Acceptance criteria

  • Figures with snapshots display formatted dates in captions ✓
  • Missing snapshots don't corrupt output ✓
  • Invalid dates handled gracefully ✓
  • SVG and raster figures supported ✓
  • All tests passing ✓

@transitrix transitrix changed the title feat: diagram captions with snapshot dates (epic #505, 3/4) feat(document-renderer): figure caption formatting with snapshot dates Sep 2, 2026
@transitrix
transitrix force-pushed the methodology/539-diagram-captions-snapshots branch 4 times, most recently from 354249b to 92c67a3 Compare September 2, 2026 21:23
Add formatFigureCaptions() to process figure elements and embed snapshot
build dates in captions. Figures with data-snapshot-id attributes now
display caption text with the formatted snapshot generation date.

- Extend render-vivliostyle.mjs with figure caption date formatting
- Update wrapHtmlForPrintRendering() to process figures before wrapping
- Add comprehensive tests for caption formatting in test_render_vivliostyle.mjs
- Update PDF_RENDERING_ENGINE.md documentation and status matrix

Figure captions now show: "Figure title (Sep 2, 2026)" when snapshots
are provided, enabling traceability from diagram to source snapshot.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Signed-off-by: transitrix <automation@transitrix.com>
@transitrix
transitrix force-pushed the methodology/539-diagram-captions-snapshots branch from 5b2d103 to dde8fac Compare September 3, 2026 20:12
@transitrix
transitrix merged commit a0816ab into main Sep 4, 2026
15 checks passed
@transitrix
transitrix deleted the methodology/539-diagram-captions-snapshots branch September 4, 2026 05:47
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