diff --git a/CHANGES b/CHANGES index 4c70a1bbb56..52254840be7 100644 --- a/CHANGES +++ b/CHANGES @@ -64,6 +64,8 @@ Bugs fixed * #9697: py domain: An index entry with parens was registered for ``py:method`` directive with ``:property:`` option * #9708: needs_extension failed to check double-digit version correctly +* Fix bug ``.. code::`` recognising ``:classes:`` option instead of ``:class:`` + option. The new behaviour is to only accept the ``:class:`` option. Testing -------- diff --git a/sphinx/directives/patches.py b/sphinx/directives/patches.py index a7b77c750bb..dd01cb34a81 100644 --- a/sphinx/directives/patches.py +++ b/sphinx/directives/patches.py @@ -15,6 +15,7 @@ from docutils.nodes import Node, make_id, system_message from docutils.parsers.rst import directives from docutils.parsers.rst.directives import images, tables +from docutils.parsers.rst.roles import set_classes from sphinx import addnodes from sphinx.deprecation import RemovedInSphinx60Warning @@ -161,6 +162,7 @@ class Code(SphinxDirective): def run(self) -> List[Node]: self.assert_has_content() + set_classes(self.options) code = '\n'.join(self.content) node = nodes.literal_block(code, code, classes=self.options.get('classes', []),