[docs] [issue12947] doctest directive examples in library/doctest.html lack the flags

Chris Jerdonek report at bugs.python.org
Wed Oct 3 09:12:21 CEST 2012

Chris Jerdonek added the comment:

I thought of an easy work-around we can use after looking at the changeset Terry referenced above:

> [2] https://bitbucket.org/birkenfeld/sphinx/changeset/d91bf8e465ef

At the expense of pretty color highlighting, we can enable Pygments' TextLexer for the affected examples (aka "null" lexer).  For example--

.. code-block:: text

   >>> raise CustomError('message') #doctest: +IGNORE_EXCEPTION_DETAIL
   Traceback (most recent call last):
   CustomError: message

I confirmed locally that this works.  I realized this might work because the Sphinx changeset referenced above has this logic:

    # trim doctest options if wanted
    if isinstance(lexer, PythonConsoleLexer) and self.trim_doctest_flags:


Python tracker <report at bugs.python.org>

More information about the docs mailing list