Closed gsauthof closed 4 years ago
Hi,
I was aware there's a bunch of aliases (and Sphinx for some reason prefers the most verbose one) but to me those seemed unnecessarily redundant, so I overrode just the .. code::
one. But now, after thinking about this a bit more, it doesn't make sense to have .. code::
work while .. code-block::
still uses the unpatched/broken vanilla directive. So I added both aliases in bfc0b365769ea2002c88c18fd1ef5996d933eb32.
The m.code plugin overwrites the docutils
code
directive such that the CSS classm-code
is emitted instead of the defaulthighlight
class, in the generated html.It turns out that docutils currently define 3 code block directives that alias each other, namely
code
,code-block
andsourcecode
:https://github.com/docutils-mirror/docutils/blob/e88c5fb08d5cdfa8b4ac1020dd6f7177778d5990/docutils/parsers/rst/languages/en.py#L22-L24
Current documentation even only mentions
code-block
andsourcecode
.Since I've some existing
.rst
files that usecode-block
I quickly patchedcode.py
which seems to work so far:Perhaps there is a better way to fix this instead of registering
code-block
andsourcecode
in this way.