On Tue, 21 May 2019 at 21:07, John Snow <js...@redhat.com> wrote: > > Sphinx, through Pygments, does not like annotated json examples very > much. In some versions of Sphinx (1.7), it will render the non-json > portions of code blocks in red, but in newer versions (2.0) it will > throw an exception and not highlight the block at all. Though we can > suppress this warning, it doesn't bring back highlighting on non-strict > json blocks. > > We can alleviate this by creating a custom lexer for QMP examples that > allows us to properly highlight these examples in a robust way, keeping > our directionality notations.
> diff --git a/docs/sphinx/qmp_lexer.py b/docs/sphinx/qmp_lexer.py > new file mode 100644 > index 0000000000..f619f11139 > --- /dev/null > +++ b/docs/sphinx/qmp_lexer.py > @@ -0,0 +1,34 @@ > +# QEMU Monitor Protocol Lexer Extension > +# > +# Copyright (C) 2019, Red Hat Inc. > +# > +# Authors: > +# Eduardo Habkost <ehabk...@redhat.com> > +# John Snow <js...@redhat.com> > +# > +# This work is licensed under the terms of the GNU GPL, version 2. See > +# the COPYING file in the top-level directory. Did you definitely mean 2-only and not 2-or-later ? thanks -- PMM