Skip to content

Can we do something to mark a code block as something we want to be immediately copyable to the clipboard? #935

@heckj

Description

@heckj

Feature Name

code block copy to clipboard

Description

I'd like to be able to select or identify code blocks within the markdown for articles to add in some additional rendering capabilities - specifically copying the entirety of the code block to the clipboard. There's some detail on the javascript that might be used at https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard, but I'm far from a Web developer expert to know if this is an ideal or suboptimal path.

Motivation

Within some documentation, especially articles where you're showing how to do something, it can be extremely helpful to be able to copy out a text block - for example, a CLI command to run in a terminal - to immediate use while you're reading the documentation.

Importance

This enhances articles that are working to show a "how to" kind of sequence to solve a problem or perform a specific task

Alternatives Considered

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions