agent-pages

Plan: Unify the Viewer Header for Markdown and HTML Pages

Download

Unify the Viewer Header for Markdown and HTML Pages

Problem

The viewer currently renders two intentionally different shell headers:

This split came from the full-screen HTML viewer design, which preserved Markdown as a traditional readable document. The result is that navigation and viewer-owned controls look like two different products even though both page formats belong to the same viewer.

This is a shell inconsistency, not a Markdown rendering or theme bug.

Desired Outcome

Use one compact top toolbar for both Markdown and HTML pages while preserving their different content behavior:

Implementation Plan

1. Create a shared toolbar partial

Add app/templates/viewer/_toolbar.html containing:

Keep the toolbar server-rendered and script-free. Continue using semantic <header>, <h1>, and <nav> elements.

2. Adopt the shared toolbar in both viewer templates

Update app/templates/viewer/html_host.html to render the shared partial without changing its iframe structure.

Update app/templates/viewer/markdown.html to:

This also reduces the prominent duplicate-heading effect when the page title and the first Markdown # heading contain similar text.

3. Refactor viewer CSS around shared chrome

In app/static/viewer.css:

4. Handle responsive layouts explicitly

Verify the shared toolbar at narrow widths:

If necessary, shorten or selectively hide nonessential action labels at the smallest breakpoint without introducing JavaScript.

5. Update automated tests

Update tests/test_viewer_smoke.py:

Update tests/test_viewer_security.py:

Update tests/test_viewer_css.py and theme tests:

Run the complete pytest suite.

6. Update documentation

Update README.md, docs/architecture.md, and MEMORY.md to explain:

Add a note to docs/full-screen-html-viewer-plan.md or link to a new decision entry so the historical document no longer appears to describe current intended behavior.

Security and Compatibility Constraints

The change must not alter:

Acceptance Criteria