Repository navigation
Show the history of each page in a drawer - #20
Merged
Merged
Conversation
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>
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.
Summary
Each page can show its own history, like
git log -pfor 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.?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 overmaxDiffLines). 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.pageHistory.entries):'footer'(default), a line before the doc footer;'nav', a button in the navigation bar;[], none, so only?historyopens it. A plugin cannot fill the layout slots, so the entries are inserted into the rendered page through portals, kept in place with aMutationObserveracross in-app navigation.PageHistoryLinkandPageHistoryButton, exported from@kazamori/rspress-plugin-git-diff/runtime(newexportsentry). Checked with a custom theme passing them toafterNavMenuandbeforeDocFooter.pageHistory(defaulttrue;falseturns it off) andmaxPageRevisions(default20, limits the list only; ranges in?diffstill use every revision).calc(100% - 16em), which left it one character wide on phones, also on the recent changes page.GIT_DIFF_HISTORY_ENTRIES(footer,nav, comma-separated or empty) chooses others.Test
historyparameter (tests/pageHistory.test.ts).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:buildpass. 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