diff --git a/CHANGES b/CHANGES index c44051f3f89..218e9cdbc03 100644 --- a/CHANGES +++ b/CHANGES @@ -19,6 +19,7 @@ Features added * #8022: autodoc: autodata and autoattribute directives does not show right-hand value of the variable if docstring contains ``:meta hide-value:`` in info-field-list +* #8619: html: kbd role generates customizable HTML tags for compound keys * #8132: Add :confval:`project_copyright` as an alias of :confval:`copyright` Bugs fixed diff --git a/sphinx/builders/html/transforms.py b/sphinx/builders/html/transforms.py index 311b1b7a032..5cf536bd001 100644 --- a/sphinx/builders/html/transforms.py +++ b/sphinx/builders/html/transforms.py @@ -28,7 +28,7 @@ class KeyboardTransform(SphinxPostTransform): After:: - + Control - @@ -46,6 +46,7 @@ def run(self, **kwargs: Any) -> None: if len(parts) == 1: continue + node['classes'].append('compound') node.pop() while parts: key = parts.pop(0) diff --git a/tests/test_markup.py b/tests/test_markup.py index 53298aeda91..ac157e75194 100644 --- a/tests/test_markup.py +++ b/tests/test_markup.py @@ -244,7 +244,7 @@ def get(name): # kbd role 'verify', ':kbd:`Control+X`', - ('

' + ('

' 'Control' '+' 'X' @@ -266,7 +266,7 @@ def get(name): # kbd role 'verify', ':kbd:`M-x M-s`', - ('

' + ('

' 'M' '-' 'x'