Skip to content

Flattening Source Rendering Through Shared Renderers

One of the remaining inconsistencies in the Footnotes Engine v2 was how sources were rendered. Grid-based content, such as Images and Elements, displayed multiple nested “Sources” sections because each content item invoked the universal source renderer independently.

Rather than modifying the existing source renderer, a new shared renderer (kp_render_grouped_references()) became the common presentation layer for grouped content. This renderer accepts multiple content owners and renders them beneath a single expandable Sources section.

The same renderer was then reused on Element pages through kp_render_element_sources(), allowing an Element’s own sources and the sources of related content to appear as one unified section. Existing rendering logic remained unchanged, minimizing risk while eliminating duplicated UI.

This approach reinforced an important architectural principle already emerging throughout Phase 2: collectors gather data, while renderers determine presentation.

Why this decision was made

  • Remove nested Sources accordions.
  • Eliminate duplicated rendering logic.
  • Keep ownership attribution visible.
  • Create reusable rendering components.

Benefits

  • Consistent UI.
  • Reduced duplication.
  • Easier future collector integration.
  • Single rendering strategy for grouped sources.

Future implications

When kp_build_source_context() is introduced, the grouped renderer can consume collector output directly without further UI changes.