Skip to contentSkip to conversation

docs: use :kbd: role in sphinx docs

PATCH Applied Manos Pitsidianakis 2 participants 2 messages Jul 9, 2025 – Jul 10, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 docs: use :kbd: role in sphinx docs

Sphinx supports the :kbd: role for notating keyboard input. They get formatted as <kbd> HTML elements in the readthedocs theme we currently use for Sphinx.

Besides the better visual formatting, it also helps with accessibility as screen readers can announce the semantics of the <kbd> element to the user.

---
Changes in v2:
- Formatted multiplexer key list as a table (suggested by Alex)
- Link to v1: https://lore.kernel.org/qemu-devel/[email protected]

---
 docs/devel/testing/main.rst     |  4 ++--
 docs/system/images.rst          |  2 +-
 docs/system/keys.rst.inc        | 49 +++++++++++++++++++++--------------------
 docs/system/linuxboot.rst       |  2 +-
 docs/system/mux-chardev.rst.inc | 38 ++++++++++++++++++--------------
 5 files changed, 51 insertions(+), 44 deletions(-)
docs/devel/testing/main.rst +2 -2
index 6b18ed875cd91e961d07b3afa3179c7fba0e5fe3..2b5cb0c148048e3a81d2db8c4a9500591880997f 100644
@@ -604,9 +604,9 @@ below steps to debug it:
 2. Add "V=1" to the command line, try again, to see the verbose output.
 3. Further add "DEBUG=1" to the command line. This will pause in a shell prompt
    in the container right before testing starts. You could either manually
-   build QEMU and run tests from there, or press Ctrl-D to let the Docker
+   build QEMU and run tests from there, or press :kbd:`Ctrl+d` to let the Docker
    testing continue.
-4. If you press Ctrl-D, the same building and testing procedure will begin, and
+4. If you press :kbd:`Ctrl+d`, the same building and testing procedure will begin, and
    will hopefully run into the error again. After that, you will be dropped to
    the prompt for debug.
 
docs/system/images.rst +1 -1
index a5551173c9789323ceb150c51fd68c6d4ef80d71..43706969fddae7bcb83de172b1a04b5c6cffe0f1 100644
@@ -30,7 +30,7 @@ Snapshot mode
 If you use the option ``-snapshot``, all disk images are considered as
 read only. When sectors in written, they are written in a temporary file
 created in ``/tmp``. You can however force the write back to the raw
-disk images by using the ``commit`` monitor command (or C-a s in the
+disk images by using the ``commit`` monitor command (or :kbd:`Ctrl+a s` in the
 serial console).
 
 .. _vm_005fsnapshots:
docs/system/keys.rst.inc +25 -24

61 lines not on this page · raw message

docs/system/linuxboot.rst +1 -1
index 2328b4a73d55b47d731497d57ddb1a837ef5d7dd..f7573ab80aa269bac870d7e6e5596a8f02fbd5f3 100644
@@ -26,5 +26,5 @@ virtual serial port and the QEMU monitor to the console with the
    |qemu_system| -kernel bzImage -drive file=rootdisk.img,format=raw \
                     -append "root=/dev/sda console=ttyS0" -nographic
 
-Use Ctrl-a c to switch between the serial console and the monitor (see
+Use :kbd:`Ctrl+a c` to switch between the serial console and the monitor (see
 :ref:`GUI_keys`).
docs/system/mux-chardev.rst.inc +22 -16
index 84ea12cbf58f9550154411f8951e6f608179a091..c87ba31362965c4e06d892217df7fedebcb3092c 100644
@@ -1,27 +1,33 @@
 During emulation, if you are using a character backend multiplexer
 (which is the default if you are using ``-nographic``) then several
 commands are available via an escape sequence. These key sequences all
-start with an escape character, which is Ctrl-a by default, but can be
+start with an escape character, which is :kbd:`Ctrl+a` by default, but can be
 changed with ``-echr``. The list below assumes you're using the default.
 
-Ctrl-a h
-   Print this help
+.. list-table:: Multiplexer Keys
+  :widths: 20 80
+  :header-rows: 1
 
-Ctrl-a x
-   Exit emulator
+  * - Key Sequence
+    - Action
 
-Ctrl-a s
-   Save disk data back to file (if -snapshot)
+  * - :kbd:`Ctrl+a h`
+    - Print this help
 
-Ctrl-a t
-   Toggle console timestamps
+  * - :kbd:`Ctrl+a x`
+    - Exit emulator
 
-Ctrl-a b
-   Send break (magic sysrq in Linux)
+  * - :kbd:`Ctrl+a s`
+    - Save disk data back to file (if -snapshot)
 
-Ctrl-a c
-   Rotate between the frontends connected to the multiplexer (usually
-   this switches between the monitor and the console)
+  * - :kbd:`Ctrl+a t`
+    - Toggle console timestamps
 
-Ctrl-a Ctrl-a
-   Send the escape character to the frontend
+  * - :kbd:`Ctrl+a b`
+    - Send break (magic sysrq in Linux)
+
+  * - :kbd:`Ctrl+a c`
+    - Rotate between the frontends connected to the multiplexer (usually this switches between the monitor and the console)
+
+  * - :kbd:`Ctrl+a Ctrl+a`
+    - Send the escape character to the frontend

---
base-commit: df6fe2abf2e990f767ce755d426bc439c7bba336
change-id: 20250703-docs_rst_improvements-1f0cb3c578d6

--
γαῖα πυρί μιχθήτω

Applied
#1 lore raw
Quoted 9 lines · Manos Pitsidianakis

Sphinx supports the :kbd: role for notating keyboard input. They get formatted as <kbd> HTML elements in the readthedocs theme we currently use for Sphinx.

Besides the better visual formatting, it also helps with accessibility as screen readers can announce the semantics of the <kbd> element to the user.

Queued to docs/next, thanks.

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro