Skip to content

Add copy-to-clipboard controls for install snippets and package citations#393

Draft
LiNk-NY with Copilot wants to merge 6 commits into
develfrom
copilot/add-copy-to-clipboard-buttons
Draft

Add copy-to-clipboard controls for install snippets and package citations#393
LiNk-NY with Copilot wants to merge 6 commits into
develfrom
copilot/add-copy-to-clipboard-buttons

Conversation

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown

Package and installation pages expose a few high-frequency copy targets, but currently require manual selection. This adds lightweight copy controls to the install commands and package citation block without broad template churn.

  • Scope

    • adds copy buttons to package installation snippets
    • adds copy buttons to install page command blocks
    • adds a copy action for the package citation content after it is loaded dynamically
  • Template changes

    • marks install-oriented <pre> blocks as opt-in copy targets via data-copyable
    • adds a citation copy button to the package detail header near the rendered citation content
  • Client-side behavior

    • extends code_blocks.js to:
      • inject copy buttons for pre[data-copyable]
      • copy either the associated code block or an explicit target (data-copy-target)
      • show short-lived success / failure state on the button
      • fall back to document.execCommand("copy") when the Clipboard API is unavailable
    • re-runs copy-button initialization after package citations are inserted asynchronously
  • Styling

    • adds compact copy-button styles for code blocks
    • reserves space at the top of copyable code blocks so the button does not overlap content
    • styles the citation copy control consistently with the existing package page UI
  • Example

    <pre data-copyable>
    <code class="dark nohighlight">
    if (!require("BiocManager", quietly = TRUE))
      install.packages("BiocManager")
    BiocManager::install("ExamplePkg")
    </code>
    </pre>

Copilot AI changed the title [WIP] Add copy to clipboard buttons for common info sections Add copy-to-clipboard controls for install snippets and package citations Jul 17, 2026
Copilot AI requested a review from LiNk-NY July 17, 2026 14:58
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 to clipboard buttons for commonly copied sections

2 participants