Skip to content

Show the history of each page in a drawer - #20

Merged
t2y merged 3 commits into
mainfrom
feature/issue-3-page-history
Oct 16, 2026
Merged

t2y merged 3 commits into
mainfrom
feature/issue-3-page-history

Conversation

@t2y

@t2y t2y commented Oct 16, 2026

Copy link
Copy Markdown
Member

Summary

Each page can show its own history, like git log -p for one file, in a drawer over the page (#3). The build-time data does not change: the drawer reads the page index and blobs already written for the on-page diff.

  • Drawer: opens when the URL has ?history. It lists the revisions newest first like the recent changes page (date, subject, hash, author, "Show on page", the lazily loaded source diff collapsed over maxDiffLines). Hidden revisions are left out, except the one that added the page, listed last without a diff. Close button, Escape, a click outside, or Back close it.
  • Entries (pageHistory.entries): 'footer' (default), a line before the doc footer; 'nav', a button in the navigation bar; [], none, so only ?history opens it. A plugin cannot fill the layout slots, so the entries are inserted into the rendered page through portals, kept in place with a MutationObserver across in-app navigation.
  • Theme components: PageHistoryLink and PageHistoryButton, exported from @kazamori/rspress-plugin-git-diff/runtime (new exports entry). Checked with a custom theme passing them to afterNavMenu and beforeDocFooter.
  • Options: pageHistory (default true; false turns it off) and maxPageRevisions (default 20, limits the list only; ranges in ?diff still use every revision).
  • Fix on the way: diff2html sized the code column as calc(100% - 16em), which left it one character wide on phones, also on the recent changes page.
  • Docs: a "Page history" guide page (en, ja), the options table, getting started, README, AGENTS.md, and the system overview diagram (finalized with archify, PNG exported at 2400px).
  • The example site places both entries by default; GIT_DIFF_HISTORY_ENTRIES (footer, nav, comma-separated or empty) chooses others.

Test

  • Unit tests for the revisions listed and the history parameter (tests/pageHistory.test.ts).
  • E2E (e2e/page-history.spec.ts): the footer entry and its count, opening from the footer and the nav, closing with Back, Escape and Close, lazy diffs, "Show on page" to the bar, in-app navigation, no entry on a page without history. All 20 E2E tests pass.
  • typecheck, test, build, docs:build pass. Checked the docs site under the GitHub Pages base path.

The content of the drawer is to be reviewed in the running site, as agreed in #3.

Refs #3

🤖 Generated with Claude Code

t2y and others added 3 commits October 16, 2026 10:49
A global component opens a drawer with the revisions of the current page
when the URL has ?history: the date, subject, author, a link to the
on-page diff and the diff of the source, loaded when it scrolls into
view. Revisions hidden from the lists are left out, except the one that
added the page.

- pageHistory (default true) turns the feature on, and its entries
  choose where the plugin places links to it: before the doc footer
  (default), in the navigation bar, or nowhere, so that only ?history
  opens it. A plugin cannot fill the layout slots, so the entries go
  into the rendered page through portals.
- PageHistoryButton and PageHistoryLink are exported from ./runtime for
  sites that place the entries in their theme.
- maxPageRevisions (default 20) limits the revisions listed.

Also keep the code column of diff2html wide enough on narrow screens.

Refs #3

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Refs #3

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- A "Page history" guide page in English and Japanese: opening the
  history, what it lists, the entries, placing them in a theme, and the
  cost of fetching the page index.
- The options table lists pageHistory and maxPageRevisions.
- The system overview diagram has a page history node in the browser.

Refs #3

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@t2y t2y self-assigned this Oct 16, 2026
@t2y
t2y merged commit b4806db into main Oct 16, 2026
2 checks passed
@t2y
t2y deleted the feature/issue-3-page-history branch October 16, 2026 02:01
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