Skip to content

feat: add Copy page dropdown and View Markdown button#2942

Open
donjo wants to merge 13 commits intomainfrom
feat/view-markdown-button
Open

feat: add Copy page dropdown and View Markdown button#2942
donjo wants to merge 13 commits intomainfrom
feat/view-markdown-button

Conversation

@donjo
Copy link
Member

@donjo donjo commented Mar 2, 2026

Screenshot 2026-03-02 at 1 17 10 PM

Summary

  • Adds a "View Markdown" button next to "Edit this page" in the feedback section at the bottom of each doc page, linking to the raw .md source
  • Adds a "Copy page" dropdown at the top of the right-hand TOC sidebar with three options:
    • Copy page link — copies the current page URL to the clipboard
    • View Page as Markdown — opens the raw .md file in a new tab
    • Open in Claude — opens claude.ai pre-prompted to read and answer questions about the page using the markdown source URL
  • Fixes the link checker by copying lint rule .md files into _site/lint/rules/ during afterBuild — these were excluded from Lume's processing pipeline by site.ignore() so they never landed in the output directory

Test plan

  • Run deno task serve
  • Navigate to any regular doc page with a TOC (e.g. /runtime/fundamentals/typescript/) and confirm the "Copy page" dropdown appears at the top of the right sidebar
  • Confirm the dropdown shows all three options and each works correctly
  • Scroll to the bottom and confirm "View Markdown" appears next to "Edit this page"
  • Navigate to a lint rule page (e.g. /lint/rules/no-var/) and confirm "View Markdown" button is visible and the link resolves
  • Confirm API reference pages (/api/...) do not show either button

Adds a ViewMarkdown component that renders a "View Markdown" link button
next to "Edit this page" in the feedback section, surfacing the raw .md
URL that the markdownSource middleware already serves.
@donjo donjo marked this pull request as draft March 2, 2026 03:13
donjo added 5 commits March 1, 2026 22:17
Adds a "Copy page" dropdown button at the top of the right-hand TOC
sidebar with three options:
- Copy page link: copies the current URL to clipboard
- View Page as Markdown: opens the raw .md file in a new tab
- Open in Claude: opens claude.ai pre-prompted to answer questions
  about the page using the markdown source URL
Lint rule pages are generated by lint_rule.page.tsx from source files
in lint/rules/, which are excluded from Lume's processing pipeline via
site.ignore(). This means the source .md files never made it into _site,
causing 125 broken links in the link checker for /lint/rules/*.md URLs.

The afterBuild hook now copies lint/rules/*.md directly into _site/lint/rules/
using Deno's file API, bypassing the ignore rules.
@donjo donjo changed the title feat: add View Markdown button to doc pages feat: add Copy page dropdown and View Markdown button Mar 2, 2026
donjo added 7 commits March 2, 2026 09:42
Move the "Copy page" dropdown from the TOC sidebar into the main content
area, inline with the page H1. The button is right-aligned in a flex
header row using <header> (not <div>) to avoid the markdown-body CSS
column override. The dropdown panel is now absolutely positioned so it
floats over content without shifting layout.
Fixes the CSS collision with .markdown-body details rules by switching
CopyPage from <details>/<summary> to a proper split button. Left half
copies the URL directly; right half opens a floating panel via the
native Popover API (light-dismiss, Escape-to-close, top-layer stacking
— no z-index needed).
…dling

- Remove ViewMarkdown component and its usage in Feedback (covered by
  CopyPage popover's "View Page as Markdown" link)
- Add .catch() to clipboard writeText so users see "Copy failed" instead
  of nothing on error
- Simplify chevron transform logic in toggle handler
- Remove redundant border: none reset in .copy-page-panel (immediately
  overridden by @apply border)
@donjo donjo requested a review from thisisjofrank March 2, 2026 18:33
@donjo donjo marked this pull request as ready for review March 2, 2026 18:33
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