Skip to content

Enable Copy-to-Clipboard for Shell and Terminal output blocks #996

Description

@R1SH4BH81

Introduction

Currently, the documentation site successfully provides "Copy" buttons for code blocks tagged with languages like javascript, tsx, and java. However, many critical blocks representing terminal output, shell commands, or environment setup logs (tagged as shell, bash, or text) lack this feature.

Details

In the Environment Setup and Troubleshooting guides, users often need to copy long commands or specific error patterns to compare with their local output.

By "swizzling" the CodeBlock component in the Docusaurus theme, we can ensure that any block with a language tag regardless of whether it's a programming language or a terminal command includes the CopyButton. This would also allow us to add logic to strip the $ or > prompts from the copied text to improve the developer experience.

Discussion points

  • Should we enable the copy button for all code blocks by default, or keep it restricted to a specific list of languages?

  • For shell blocks, should we implement a filter that automatically removes the command prompt symbols ($, >>) from the clipboard content?

  • Are there specific accessibility (a11y) considerations for adding buttons to non-syntax-highlighted text blocks?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions