python-sphinx

How to create a nested list in reStructuredText?

眉间皱痕 提交于 2019-12-31 10:57:46
问题 I am trying to create a properly nested list using the following code (following Sphinx and docutils docs): 1. X a. U b. V c. W 2. Y 3. Z I expect this to result in two OL s but I get the following output instead: <ol class="arabic simple"> <li>X</li> </ol> <blockquote> <div> <ol class="loweralpha simple"> <li>U</li> <li>V</li> <li>W</li> </ol> </div> </blockquote> <ol class="arabic simple" start="2"> <li>Y</li> <li>Z</li> </ol> What am I doing wrong? Is it not possible to get the following

How to create a nested list in reStructuredText?

喜夏-厌秋 提交于 2019-12-31 10:57:12
问题 I am trying to create a properly nested list using the following code (following Sphinx and docutils docs): 1. X a. U b. V c. W 2. Y 3. Z I expect this to result in two OL s but I get the following output instead: <ol class="arabic simple"> <li>X</li> </ol> <blockquote> <div> <ol class="loweralpha simple"> <li>U</li> <li>V</li> <li>W</li> </ol> </div> </blockquote> <ol class="arabic simple" start="2"> <li>Y</li> <li>Z</li> </ol> What am I doing wrong? Is it not possible to get the following

Combining Sphinx documentation from multiple subprojects: Handling indices, syncing configuration, etc

做~自己de王妃 提交于 2019-12-31 09:18:20
问题 We have a multi-module project documented with the (excellent) Sphinx. Our setup is not unlike one described on the mailing list. Overall this works great! But we have a few questions about doing so: The submodule tables of contents will include index links. At best these will link to the wrong indices. (At worst this seems to trigger a bug in Sphinx, but I'm using the devel version so that's reasonable). Is there a way of generating the index links only for the topmost toctree? Are there

Sphinx, reStructuredText show/hide code snippets

耗尽温柔 提交于 2019-12-31 08:38:45
问题 I've been documenting a software package using Sphinx and reStructuredText. Within my documents, there are some long code snippets. I want to be able to have them hidden as default, with a little "Show/Hide" button that would expand them (Example). Is there a standard way to do that? 回答1: I think the easiest way to do this would be to create a custom Sphinx theme in which you tell certain html elements to have this functionality. A little JQuery would go a long way here. If, however you want

End literal block in list item

北战南征 提交于 2019-12-31 03:45:35
问题 I have a list item in my rst file that I would like to put a literal block into, but I am unable to get the literal block to end properly. This is my rst: 1. Item 1 (not literal) 2. Item 2:: MyCode.example() Description of the code shown above (not literal) I would like the paragraph starting with Description to be outside the literal block above it, but still part of list item #2. The only workaround I have been able to come up with is this: 1. Item 1 (not literal) 2. Item 2: :: MyCode

Substitution in Admonitions

时光怂恿深爱的人放手 提交于 2019-12-31 01:51:07
问题 How can I do a substitution in an admonition? For example: |p| account .. note:: **Been using |p| separately and now integrating?** In my sphinx conf.py I define a replacement rule which gets appended to the rst file prior to interpretation (at least that is how I understand it): rst_epilog = '.. |p| replace:: Labnext' My first substitution in the paragraph works without fail. However the substitution in the note directive isn't applied. Any work arounds? Thanks, Mike 回答1: The substitution in

Creating LaTeX math macros within Sphinx

心已入冬 提交于 2019-12-29 04:44:07
问题 I'm writing some mathematical code in Python and using Sphinx to produce the documentation. I know that Sphinx can handle LaTeX code in Python docstrings; see http://sphinx.pocoo.org/latest/ext/math.html#module-sphinx.ext.mathbase. How can I create LaTeX macros, such as \newcommand{\cG}{\mathcal{G}} , to use in the Python docstrings? 回答1: If you are using MathJax, here's a possible solution. I'm still looking for a nicer solution, but it might help if you need a quick hack. Create a file

Sphinx: how to exclude imports in automodule?

余生颓废 提交于 2019-12-28 06:00:13
问题 I have a Raspberry Pi project written in Python that uses RPi.GPIO module. All the work on the code is done on a Windows box where RPi.GPIO will not install and every time I try to run autodoc it crashes saying it cannot import RPi.GPIO. D:\cube\docs\ledcube.rst:4: WARNING: autodoc: failed to import module u'ledcube' ; the following exception was raised: Traceback (most recent call last): File "C:\Python27\lib\site-packages\sphinx-1.2b1-py2.7.egg\sphinx\ext\autodoc. py", line 326, in import

Customize sphinxdoc theme

时光毁灭记忆、已成空白 提交于 2019-12-28 02:45:09
问题 Is there an easy way to customize the existing sphinxdoc theme? For the default theme, there are many theme-attributes, but in sphinxdoc I can't even set a logo or change some colors? Or can you recommend my a site where I can learn how to modify themes? 回答1: All I wanted is to add ReST strikethrough in my sphinx doc. Here is how I did it: $ cd my-sphinx-dir $ mkdir -p theme/static $ touch theme/theme.conf $ touch theme/static/style.css In theme/theme.conf : [theme] inherit = default

Adding custom tag in Sphinx

妖精的绣舞 提交于 2019-12-25 07:41:23
问题 I am using Sphinx tool for documentation and ran into a situation where I want to expose a piece of information in only one file format. I came across this link which addresses a similar issue with help of only directive. The issue I am facing is I want to use the only directive with a custom tag .. only:: xyz ..directive :: :maxdepth: 1 good_stuff I am using a setup.py file for building, and running BuildDoc.run(self) to generate the html files. I want somehow pass this custom tag in the