Skip to content

Better highlight selection for bash code blocks (copy and paste) #6865

@lakhman

Description

@lakhman

Currently when you double click on a bash code block, the $ is also selected.

By using the following jQuery snippet we can add a no-select to it to prevent it from being selected.

$(".highlight-bash pre span.nv:contains('$ ')").css('userSelect', 'none')

:contains seemed to suffice, maybe check if the element exactly contains the text to be 100% sure.

Could we add something like this to the symfony docs pages? It would make copy and paste that little bit easier. 😀 #lazy-programmer

No selecting $ in bash

This prevents the following when copy and pasting:

> $ composer require friendsofsymfony/user-bundle "~2.0@dev"
bash: $: command not found

👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    WebsitehasPRA Pull Request has already been submitted for this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions