This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author JDLH
Recipients Anthony Sottile, JDLH, cheryl.sabella, docs@python, eric.araujo, ezio.melotti, gregory.p.smith, jdemeyer, mdk, miss-islington, steven.daprano, terry.reedy, willingc
Date 2021-01-25.20:57:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1611608261.03.0.688946243946.issue36675@roundup.psfhosted.org>
In-reply-to
Content
My goodness, things get complex sometimes. 

If we cannot make Sphinx preserve doctest directives and comments, perhaps we should go back to the historical bug discussion to look at workarounds which we considered earlier. For instance, maybe we should modify the text surrounding the examples to explain that doctests directives should appear there, but that our tool chain currently removes them.

At the moment, I see doctest directives in the doctest source code at: 
https://github.com/python/cpython/blob/master/Doc/library/doctest.rst#directives 
which do not appear in the corresponding HTML output at:
https://docs.python.org/3/library/doctest.html#directives 

How about rewording the text before each of those examples? Or maybe finding some way to show those examples as literal text which Sphinx won't modify, even if it is not formatted like Python code examples?

By the way, the discussion of this same problem back in 2011-2012 is at #12947 . At that time, we applied a "monkey patch" to the Sphinx code. I haven't read the discussion closely enough to figure out if such a patch would help now.
History
Date User Action Args
2021-01-25 20:57:41JDLHsetrecipients: + JDLH, terry.reedy, gregory.p.smith, ezio.melotti, eric.araujo, steven.daprano, docs@python, jdemeyer, willingc, Anthony Sottile, mdk, cheryl.sabella, miss-islington
2021-01-25 20:57:41JDLHsetmessageid: <1611608261.03.0.688946243946.issue36675@roundup.psfhosted.org>
2021-01-25 20:57:41JDLHlinkissue36675 messages
2021-01-25 20:57:40JDLHcreate