Skip to content

TOC fixes#995

Merged
luke-whos-here merged 3 commits into
mainfrom
luke-toc-fixes
May 22, 2026
Merged

TOC fixes#995
luke-whos-here merged 3 commits into
mainfrom
luke-toc-fixes

Conversation

@luke-whos-here
Copy link
Copy Markdown
Contributor

This PR fixes two issues in the TOC panel of the docs site.

  1. "Copy as Markdown" didn't work on docs in the /api directory. This was due to the autogenerated docs not having an editUrl from which to generate a link to the raw content. Now adjusted to use metadata.source as the basis of the link instead. (This fixes Copy as Markdown doesn't work on API page. #973)
  2. No scrollbar in the TOC. This has been fixed by removing a legacy SCSS override, and editing the TOC theme settings to allow the content block to shrink correctly.

In addition, the erroneous installation command in #974 has been opportunistically fixed.

The above changes have been tested locally and confirmed to resolve the relevant issues.

- Change Markdown source to use metadata.source as the basis, rather than editUrl.
- Change "Copy as Markdown" button to conditionally show only when the Markdown source can be resolved.

These changes are intended to allow autogenerated docs in the api directory to work with the "Cope as Markdown" option, and also to future-proof other docs incompatible with the option from displaying it.
Opportunistically fix incorrect command to install versioned templates in install-avalonia.mdx. (Raised in #974)
- Removed override settings in _toc.scss, which were overwriting the swizzled TOC component.
- Adjust settings of the scroll container to allow the child block to shrink below the content height.
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

This PR addresses usability issues in the docs site TOC panel by restoring proper scrolling behavior and fixing “Copy as Markdown” for generated API reference pages, plus an opportunistic correction in the installation docs.

Changes:

  • Fix “Copy as Markdown” on /api pages by deriving the raw source URL from metadata.source rather than editUrl.
  • Restore TOC scrollbar behavior by switching TOC wrapper/content to a flex layout and removing a conflicting legacy SCSS override.
  • Update the install guide’s Avalonia templates version install command.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/theme/TOC/styles.module.css Makes the TOC wrapper a flex column and allows the TOC list to shrink/scroll properly.
src/theme/TOC/index.tsx Builds a raw GitHub URL from metadata.source and conditionally shows “Copy as Markdown”.
src/styles/components/_toc.scss Removes legacy layout/overflow overrides that prevented TOC scrolling.
docs/get-started/install-avalonia.mdx Updates the pinned Avalonia.Templates install instruction.

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

Comment thread docs/get-started/install-avalonia.mdx
@luke-whos-here luke-whos-here merged commit e5fdfe0 into main May 22, 2026
7 checks passed
@luke-whos-here luke-whos-here deleted the luke-toc-fixes branch May 22, 2026 17:08
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.

Copy as Markdown doesn't work on API page.

2 participants