doc: Configure copybutton extension for ignoring shell prompts

Add required settings for telling the copybutton Sphinx extension to
ignore prompts when copying a code block.

Both bash prompt and Zephyr UART prompt are ignored.

Examples of the new behavior:

.. code-block:: console

    $ echo "Hello World"
    Hello World

The copied text will be: 'echo "Hello World"'.

.. code-block:: console

   uart:~$ l2cap connect 29
   Chan sec: 1
   L2CAP connection pending
   Channel 0x20000210 connected
   Channel 0x20000210 status 1
   uart:~$ l2cap send 3 14
   Rem 2
   Rem 1
   Rem 0
   Outgoing data channel 0x20000210 transmitted
   Outgoing data channel 0x20000210 transmitted
   Outgoing data channel 0x20000210 transmitted

The copied text will be: 'l2cap connect 29\nl2cap send 3 14'.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit is contained in:
Benjamin Cabé 2023-10-17 22:38:31 -04:00 committed by Johan Hedberg
commit b3a52f4882

View file

@ -313,6 +313,11 @@ graphviz_dot_args = [
"-Ecolor=gray60",
]
# -- Options for sphinx_copybutton ----------------------------------------
copybutton_prompt_text = r"\$ |uart:~\$ "
copybutton_prompt_is_regexp = True
# -- Linkcheck options ----------------------------------------------------
extlinks = {