Skip to content

feat: add toc#974

Merged
perber merged 1 commit into
mainfrom
feature/toc-impl
May 9, 2026
Merged

feat: add toc#974
perber merged 1 commit into
mainfrom
feature/toc-impl

Conversation

@perber
Copy link
Copy Markdown
Owner

@perber perber commented May 9, 2026

No description provided.

Copilot AI review requested due to automatic review settings May 9, 2026 19:10
@perber perber force-pushed the feature/toc-impl branch from 0f17db2 to 5c2177e Compare May 9, 2026 19:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a table-of-contents (TOC) affordance to the page viewer, including a new subheader area and improved headline scrolling behavior so users can navigate to sections more easily.

Changes:

  • Introduces TOC extraction + a dropdown UI for navigating headings.
  • Adds a new “subheader” mount point in the main layout and moves viewer breadcrumbs/metadata into it.
  • Refactors headline hash scrolling into a shared utility and adds an e2e test covering sticky-subheader hash navigation.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ui/leafwiki-ui/src/lib/scrollToHeadline.ts New shared helper to scroll to a headline id from a URL hash.
ui/leafwiki-ui/src/features/viewer/useScrollToHeadline.tsx Uses the new shared scroll helper instead of inline logic.
ui/leafwiki-ui/src/layout/AppLayout.tsx Adds a subheader root above the scrollable <main> area.
ui/leafwiki-ui/src/features/viewer/PageViewer.tsx Renders breadcrumbs/metadata + TOC button into the subheader via a portal.
ui/leafwiki-ui/src/features/viewer/Breadcrumbs.tsx Adds icon and improves breadcrumb accessibility labeling.
ui/leafwiki-ui/src/index.css Styles for the new main column/subheader and updated viewer/breadcrumb styles.
ui/leafwiki-ui/src/features/preview/TocDropdownButton.tsx New dropdown component for TOC entries and click-to-scroll.
ui/leafwiki-ui/src/features/preview/extractTocEntries.ts New markdown-to-TOC parser that mirrors slugging/duplication behavior.
ui/leafwiki-ui/src/features/preview/rehypeLineNumber.ts Exports slugifyHeadline so TOC extraction can share slug logic.
ui/leafwiki-ui/src/features/preview/MarkdownPreview.tsx Adds optional TOC-related props and inline TOC rendering support.
e2e/tests/page.spec.ts Adds e2e test ensuring hash navigation doesn’t land under the sticky subheader.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui/leafwiki-ui/src/lib/scrollToHeadline.ts Outdated
Comment thread ui/leafwiki-ui/src/lib/scrollToHeadline.ts Outdated
Comment thread ui/leafwiki-ui/src/features/preview/extractTocEntries.ts
Comment thread ui/leafwiki-ui/src/features/preview/extractTocEntries.ts Outdated
@perber perber force-pushed the feature/toc-impl branch from 5c2177e to 904064c Compare May 9, 2026 19:16
@perber perber force-pushed the feature/toc-impl branch from 904064c to 57074df Compare May 9, 2026 19:23
@perber perber merged commit f7f4db5 into main May 9, 2026
6 checks passed
@perber perber deleted the feature/toc-impl branch May 9, 2026 19:31
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.

2 participants