Details
-
New Feature
-
Resolution: Won't Fix
-
Major
-
None
-
None
-
1
Description
After discussing it with Simon Dew and Richard Smedley, we tentatively agreed that writers should document commands that are intended to be copied and run by the user by placing them in source blocks with the shell or console language e.g. [source,shell].
When commands use source blocks with the shell or console language, we want we want to apply the following rule:
IF a code block is [source,shell/console] AND IF the [source,shell/console] code block starts with a prompt character ($, %, #, etc) THEN style the command using CSS in such a way that the prompt character cannot be selected (or copied by the copy-to-clipboard feature).
This helps the user copy and paste a valid command.
We have also considered adding an AsciiDoctor extension to strip any prompt character that begins a code block, AND IF the [source,shell/console] code block does not start with a prompt character ($, %, #, etc) THEN display the default $ character using the CSS style. An example of a similar behavior is given in the AsciiDoctor manual: https://asciidoctor.org/docs/user-manual/#tree-processor-example.
However, see discussion below as to why this (stripping the prompt character, then adding it again using CSS) might not be a good idea.
Attachments
Issue Links
- relates to
-
DOC-4957 Add copy button to code blocks
- Resolved
- links to