Skip to content

fix(tree_renderer): embed PageIndex page images in the summary (#166) - #217

Open
hudsonwa wants to merge 1 commit into
VectifyAI:mainfrom
hudsonwa:fix/embed-pageindex-images-in-summary
Open

fix(tree_renderer): embed PageIndex page images in the summary (#166)#217
hudsonwa wants to merge 1 commit into
VectifyAI:mainfrom
hudsonwa:fix/embed-pageindex-images-in-summary

Conversation

@hudsonwa

Copy link
Copy Markdown

What

Fixes #166. Long-doc (PageIndex) images were extracted to
wiki/sources/images/<doc>/ and referenced in the per-page JSON, but
render_summary_md never read them — so they were invisible in the summary a
human actually opens.

_write_long_doc_artifacts already has the per-page pages list in scope; this
passes it through to render_summary_md, builds a page -> [image paths] map,
and embeds each node's page-range figures inline.

Why this shape

  • Path resolution: per-page image paths are wiki-root-relative
    (sources/images/<doc>/file.png). The summary lives one level deeper
    (wiki/summaries/), so they're rewritten to ../sources/images/... — the
    form Obsidian/GitHub resolve from the summary note. (md_image_ref already
    does the equivalent note-relative rewrite for source pages.)
  • Index basis: node start_index/end_index are 0-based page indices;
    the per-page map is keyed 1-based, so the node range is shifted by +1.
  • No duplicates: a figure spanning pages covered by several sibling nodes
    is emitted once (emitted set threaded through the recursion).

Verification

  • pytest tests/test_tree_renderer.py tests/test_indexer.py39 passed
    (11 renderer incl. 4 new image tests + 28 indexer).
  • New tests cover: images embedded from a node's page range, no images without
    pages, dedup across overlapping sibling nodes, and images outside a node's
    range excluded.
  • tests/test_file_size.py (module < 800-line invariant) → 5 passed.

Area for review

The node-page index mapping (start_index/end_index 0-based vs 1-based page
numbers) is the detail most worth checking against a real densely-figured
ingest.

…fyAI#166)

Long-doc (PageIndex) images are extracted to wiki/sources/images/<doc>/ and
referenced in the per-page JSON, but render_summary_md never read them, so
they were invisible in the rendered summary a human actually opens.

Pass the per-page list through from _write_long_doc_artifacts, build a
page -> image-path map, and embed each node's page-range figures inline with
paths relative to the summary's own directory (../sources/images/...).
Already-emitted paths are tracked so a figure spanning several sibling nodes
is shown only once.
@hudsonwa
hudsonwa marked this pull request as ready for review August 11, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant