Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add a "Copy Commands" button for shell-session snippets #16408

Merged
merged 1 commit into from
Jun 8, 2021

Commits on Jun 3, 2021

  1. docs: add a "Copy Commands" button for shell-session snippets

    Add a "Copy Commands" to some code blocks. This new button attempts to
    copy only commands (and not their output) to the clipboard. The
    distinction between commands and output relies on the presence of a
    prompt symbol, either "$" or "#", at the beginning of the commands. If a
    command ends with a trailing backslash, copy the next line as well.
    
    For example, the following snippet:
    
        .. code-block:: shell-session
    
            $ ls -l
            foo
            cat
            $ echo 1 \
            2 \
                    3\
                4
            $nospace
            # exit
    
    should place the following text into the clipboard:
    
        ls -l
        echo 1
        2
                3
            4
        exit
    
    The button is added for the following blocks, when they contain several
    lines and at least one command is found in the block:
    
    - "code-block", but with language "shell-session" only,
    - Literal blocks ("::"),
    - Parsed literals.
    
    Signed-off-by: Quentin Monnet <quentin@isovalent.com>
    qmonnet committed Jun 3, 2021
    Configuration menu
    Copy the full SHA
    46e0712 View commit details
    Browse the repository at this point in the history