restructuredtext

How can I make a non-breaking space in reStructuredText?

蹲街弑〆低调 提交于 2019-11-30 00:57:58
问题 How can I make a non-breaking space in reStructuredText? An obvious but problematic solution is: `word A` But it might be treated differently by different implementations, such as rst2latex or rst2pdf. Plus it is rendered in italics. 回答1: I don't see the problem here, running docutils v0.9. At least rst2latex and rst2html are behaving properly regarding non-breaking whitespace. Latex generates ~ and html generates   when you input a non-breaking character (\xa0, \0240). Maybe you have an

Part of a word bold in reStructuredText

痞子三分冷 提交于 2019-11-30 00:15:06
问题 How can I make a part of a word bold in reStructuredText? Here is an example of what I need: ".rst stands for r e s tructured t ext." 回答1: I was surprised that you could not simply write .rst stands for **r**e**s**tructured **t**ext. but the reStructuredText specification indeed states that inline markup must be followed by white-space or one of - . , : ; ! ? \ / ' " ) ] } or > , so the above string of reStructuredText is not valid. However, only a minor change is required to get valid

Math in reStructuredText with LaTeX

穿精又带淫゛_ 提交于 2019-11-29 19:51:44
I would like to use a lightweight markup language to take notes in my college classes. My editor of choice is gedit, and I found reStructuredText Tools for Gedit , which will run the reStructuredText processor and render the HTML in a pane in gedit. This is great, and 80% of the way there. But for many of my classes I need to include math equations or greek characters in my notes. Although I'm not very familiar with LaTeX, my understanding is that it has these capabilities. How can I use LaTeX in a reST document? Would the reST document need to be processed into LaTeX, then that rendered into

Have the same README both in Markdown and reStructuredText

强颜欢笑 提交于 2019-11-29 18:45:33
I have a project hosted on GitHub. For this I have written my README using the Markdown syntax in order to have it nicely formatted on GitHub. As my project is in Python I also plan to upload it to PyPi . The syntax used for READMEs on PyPi is reStructuredText. I would like to avoid having to handle two READMEs containing roughly the same content; so I searched for a markdown to RST (or the other way around) translator, but couldn't find any. The other solution I see is to perform a markdown/HTML and then a HTML/RST translation. I found some ressources for this here and here so I guess it

reStructuredText tool support

时光怂恿深爱的人放手 提交于 2019-11-29 18:30:53
I am a great fan of reStructuredText , however the tools that support it are scattered all over the Internet. The official tool list is incomplete and/or outdated, and can be updated only via commit privileges. For some time there was a comprehensive list at the Wikipedia reStructuredText page , but this apparently " did not meet the notability guideline for web content " and was removed . So to put it in a question form: What tool support can one expect to find when working with reStructuredText, e.g. text editors, Wiki software, converters to and from reStructuredText etc.? Chen Levy

Substitutions in Sphinx code blocks

安稳与你 提交于 2019-11-29 16:00:58
问题 In this reST example meant to be rendered by Sphinx, |yaco_url| doesn't get replaced because it's in a code-block: .. |yaco_url| replace:: http://yaco.es/ You can use wget to download it: .. code-block:: console $ wget |yaco_url|package.tar.gz I wonder if there is some way to force the replacement of |yaco_url| before rendering the code block. 回答1: Use the "parsed-literal" directive. .. parsed-literal:: ./home/user/somecommand-|version| Source: https://groups.google.com/forum/?fromgroups=#

Conditional toctree in Sphinx

我怕爱的太早我们不能终老 提交于 2019-11-29 14:27:16
问题 I want to do multiple versions of a documentation, which differ in the sections that are included. To achieve this I would usually use either the only directive or the ifconfig extension. However, I cannot use any of those in combination with the toctree directive. What I basically want is something like this: .. toctree:: :maxdepth: 2 intro strings datatypes numeric .. only:: university complex Is there a way to do that? 回答1: My previous answer fails if you have hierarchies of table of

Render output from markdown file inside .rst file

血红的双手。 提交于 2019-11-29 14:18:17
I am using Sphinx for documenting a Python project and would like to have content from an existing .md file display inside of a .rst file. ( I have already set up my conf.py to allow for markdown). For example, I have a file called tutorial.md . I also have a .rst file as follows: ml == w2v ^^^ .. automodule:: package.ml.w2v :members: I would like be able to include a link to tutorial.md as follows, such that the content of tutorial.md will display in the file upon rendering. This can be achieved with the following: ml == Tutorial -------- .. include:: ../tutorial.md w2v ^^^ .. automodule::

What are some approaches to outputting a Python data structure to reStructuredText

偶尔善良 提交于 2019-11-29 14:09:48
问题 I have a list of tuples in Python that I would like to output to a table in reStructuredText. The docutils library has great support for converting reStructuredText to other formats, but I want to write directly from a data structure in memory to reStructuredText. 回答1: I'm not aware of any libraries to output RST from python data structures, but it's pretty easy to format it yourself. Here's an example of formatting a list of python tuples to an RST table: >>> data = [('hey', 'stuff', '3'), (

How to handle two dashes in ReST

别说谁变了你拦得住时间么 提交于 2019-11-29 13:21:29
I'm using Sphinx to document a command line utility written in Python. I want to be able to document a command line option, such as --region like this: **--region** <region_name> in ReST and then use Sphinx to to generate my HTML and man pages for me. This works great when generating man pages but in the generated HTML, the -- gets turned into - which is incorrect. I have found that if I change my source ReST document to look like this: **---region** <region_name> The HTML generates correctly but now my man pages have --- instead of -- . Also incorrect. I've tried escaping the dashes with a