restructuredtext

editors for tables in Sphinx/reStructuredText?

女生的网名这么多〃 提交于 2019-12-05 15:36:27
问题 I'm looking at using Sphinx / reStructuredText for documentation, and it looks very promising, except tables look like a pain to do. Is there an editor that can help? 回答1: Emacs acts as the default (or the most natural choice) for editing reStructuredText. With that in mind table mode meshes pretty well with the way reST do tables. 回答2: ReSTedit is good and simple if you're using a Mac. The Wikipedia page lists others. 来源: https://stackoverflow.com/questions/1716232/editors-for-tables-in

'Unexpected Section Title' with Sphinx — is numpy the issue?

蓝咒 提交于 2019-12-05 15:07:57
When running sphinx-build . html/ in my doc/ directory, I get the following output: $ sphinx-build . html/ Running Sphinx v0.6.4 No builder selected, using default: html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 1 changed, 0 removed reading sources... [100%] index reST markup error: HIDDEN/PATH/matplotlib_visualization.py:docstring of simulator.extensions.matplotlib_visualization.beta:20: (SEVERE/4) Unexpected section title. This file has numpy imports, and after a little research, it seems like the RST

How to add rst format in nodes for directive?

纵饮孤独 提交于 2019-12-05 12:09:59
How I can use rst in nodes? For example I want to output icluded file about.rst class Foo(Directive): def run(self): return [ nodes.Text("**adad**"), # <-- Must be a bold text nodes.Text(".. include:: about.rst"), # <-- Must include file ] You can construct a ViewList of your raw rst data (one line per entry), get Sphinx to parse that content, and then return the nodes Sphinx gives you. The following worked for me: from docutils import nodes from docutils.statemachine import ViewList from sphinx.util.compat import Directive from sphinx.util.nodes import nested_parse_with_titles class Foo

Using RestructuredText and Sphinx to include a preformatted file

妖精的绣舞 提交于 2019-12-05 11:43:24
I'm trying to make this fragment work: Version History --------------- These are the versions over time:: .. include:: ../../CHANGES.txt That is, use the include directive so that a file is included as a block quote. Once inside a block quote, the directive is quoted. I want the contents of the file in a block quote. Any idea how to do this? I think the .. literalinclude:: directive should give you what you want. 来源: https://stackoverflow.com/questions/2465080/using-restructuredtext-and-sphinx-to-include-a-preformatted-file

Non-TOC headings within a Restructuredtext page

僤鯓⒐⒋嵵緔 提交于 2019-12-05 10:34:49
I'm writing some documentation using Sphinx. Is there a way to format headings within a page which do not become part of the TOC? Ideally with some hierarchy that is reflected in formatting? E.g. I want to do My page TOC heading =================== Subheading (not in TOC, and should be formatted e.g. smaller than the heading) +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Sub-subheading (not in TOC, and formatted e.g. smaller than the subheading) ########################################################################### Any other suggestions for how to markup the text so that

How to fix column width in reStructuredText tables?

ε祈祈猫儿з 提交于 2019-12-05 04:21:20
I am using Sphinx to create this table: +---------------+---------------------+---------------------------+-------------------------------------+---------------------+ | Stakeholder | Major Value | Attitudes | Constraints | Major Interests | +===============+=====================+===========================+=====================================+=====================+ | Manager | Reduce data entry. | Strong commitment through | Cost, time and the required skill to| Google apps | | | Improve ft | release 4. | develop this application. | integration. | | | productivity. | | | | +---------------+-

How to deal with duplicate target names in reStructuredText?

亡梦爱人 提交于 2019-12-05 02:52:05
问题 Example: foo is a tool used to do foo. Download_ .. _Download: http://example.com/foo blah blah blah (omit a lot of paragraphs) bar is another tool to do bar. Download_ .. _Download: http://example.com/bar Since Download points to different urls, docutilus gives this error report: Duplicate target name, cannot be used as a unique reference: "Download". While in markdown, I can specify different id for this two Download : [Download][download-foo] [download-foo]: http://example.com/foo

python rtype docstring/restructured text for class factories/selectors

爷,独闯天下 提交于 2019-12-05 02:35:31
:rtype: specifies that this is type of returned object Therefore, when I create object obj in following snippet I receive warning from IDE, that cls is not callable , since IDE expects, that cls is object of type SomeAbstractClass , and I want SomeAbstractClass itself IDE is right, since this is default behaviour. But how can I specify, that I am returning class, not instance of class? Specifying type instead of SomeAbstractClass helps a bit, but not a solution, since no further introspection available. def class_selector(data): """ :rtype: SomeAbstractClass :return: Return some class based on

Image in README.rst not displaying in pypi

这一生的挚爱 提交于 2019-12-05 02:28:11
I would like an image linked in my README.rst file to be displayed when I upload my package to PyPI. In my README I have: .. image:: example-python.png :height: 100px :width: 200px :scale: 100 % :align: center and in MANIFEST.in I have: # Include the image file include example-python.png Right now it's not displaying in testpypi. It shows up just fine on GitHub, however. Am I doing something wrong? In .. image:: example-python.png you use relative URL, i.e. a browser expects the image in the same directory as the package. I doubt it's possible to upload an image at PyPI. Upload it somewhere

How do I create a new line with reStructuredText?

ぐ巨炮叔叔 提交于 2019-12-05 02:11:44
How do I force a line break/new line in rst? I don't want it to be a new paragraph (ie. no additional spaces between the lines), I just want the text to start on a new line. Thanks! The line block syntax also worked, and was a bit cleaner: | This is a line | This is another line | Another new line According to the docs for docutils raw role , you can do this: If there just *has* to be a line break here, :raw-html:`<br />` it can be accomplished with a "raw"-derived role. But the line block syntax should be considered first. You will need to define the raw role first: .. role:: raw-html(raw)