fix(tree_renderer): embed PageIndex page images in the summary (#166) - #217
Draft
hudsonwa wants to merge 1 commit into
Draft
fix(tree_renderer): embed PageIndex page images in the summary (#166)#217hudsonwa wants to merge 1 commit into
hudsonwa wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes #166. Long-doc (PageIndex) images were extracted to
wiki/sources/images/<doc>/and referenced in the per-page JSON, butrender_summary_mdnever read them — so they were invisible in the summary ahuman actually opens.
_write_long_doc_artifactsalready has the per-pagepageslist in scope; thispasses it through to
render_summary_md, builds apage -> [image paths]map,and embeds each node's page-range figures inline.
Why this shape
(
sources/images/<doc>/file.png). The summary lives one level deeper(
wiki/summaries/), so they're rewritten to../sources/images/...— theform Obsidian/GitHub resolve from the summary note. (
md_image_refalreadydoes the equivalent note-relative rewrite for source pages.)
start_index/end_indexare 0-based page indices;the per-page map is keyed 1-based, so the node range is shifted by +1.
is emitted once (
emittedset threaded through the recursion).Verification
pytest tests/test_tree_renderer.py tests/test_indexer.py→ 39 passed(11 renderer incl. 4 new image tests + 28 indexer).
pages, dedup across overlapping sibling nodes, and images outside a node'srange excluded.
tests/test_file_size.py(module < 800-line invariant) → 5 passed.Area for review
The node-page index mapping (
start_index/end_index0-based vs 1-based pagenumbers) is the detail most worth checking against a real densely-figured
ingest.