restructuredtext

Python convert sphinx RST to HTML

被刻印的时光 ゝ 提交于 2021-02-10 02:47:10
问题 I have tried this code: from docutils.core import publish_string text = publish_string(open(file_path, 'r').read(), writer_name='html') But it says: <p>Unknown directive type "toctree".</p> So it won't work with some specific sphinx directives. What is the easiest way to do same stuff for sphinx RST files? upd. Seems like it must be: sphinx-build -b singlehtml -D extensions='sphinx.ext.autodoc' -D master_doc='index' -C /mypath/docs . How can I call that from Python code instead of console?

Creating a literal text block in Sphinx

淺唱寂寞╮ 提交于 2021-02-09 11:12:51
问题 I would like to make a directory tree in a docstring and have it rendered without change to my Sphinx documentation, but I am having trouble. I have tried using: single, double, and triple back-ticks; literal :code: ; and literal .. code-block:: python to get this to work. I imagine the latter two did not work because this block is also not valid Python/code. In addition I have varied the number and type of indentation and spacing, to no avail. My example (using three back-ticks to delineate

Creating a literal text block in Sphinx

心已入冬 提交于 2021-02-09 11:12:38
问题 I would like to make a directory tree in a docstring and have it rendered without change to my Sphinx documentation, but I am having trouble. I have tried using: single, double, and triple back-ticks; literal :code: ; and literal .. code-block:: python to get this to work. I imagine the latter two did not work because this block is also not valid Python/code. In addition I have varied the number and type of indentation and spacing, to no avail. My example (using three back-ticks to delineate

How to include an internal reference in a code block?

女生的网名这么多〃 提交于 2021-02-07 06:14:10
问题 In my Sphinx .rst document I have a code block containing a tree view of the structure of my product using the UNIX tree command: |── parent | |── child | |── grandchild It's in a code block so that Sphinx preserves the whitespaces. I want readers to be able to click on each node to follow an internal hyperlink to the part of the document that describes that node. However, adding a :ref: inside the code block doesn't work (see below). Does anyone know how to achieve this? This doesn't work: .

How to include an internal reference in a code block?

China☆狼群 提交于 2021-02-07 06:13:13
问题 In my Sphinx .rst document I have a code block containing a tree view of the structure of my product using the UNIX tree command: |── parent | |── child | |── grandchild It's in a code block so that Sphinx preserves the whitespaces. I want readers to be able to click on each node to follow an internal hyperlink to the part of the document that describes that node. However, adding a :ref: inside the code block doesn't work (see below). Does anyone know how to achieve this? This doesn't work: .

How to include an internal reference in a code block?

折月煮酒 提交于 2021-02-07 06:12:02
问题 In my Sphinx .rst document I have a code block containing a tree view of the structure of my product using the UNIX tree command: |── parent | |── child | |── grandchild It's in a code block so that Sphinx preserves the whitespaces. I want readers to be able to click on each node to follow an internal hyperlink to the part of the document that describes that node. However, adding a :ref: inside the code block doesn't work (see below). Does anyone know how to achieve this? This doesn't work: .

How to right-align columns content in reStructuredText simple tables?

瘦欲@ 提交于 2021-02-06 07:24:12
问题 I'm editing the documentation for a project of mine using Sphinx, which in turn uses reStructuredText as markup language. I have a simple table (as opposed to grid table ) in which the rightmost column reports contains numbers that I would like to right-align, but I couldn't find how to achieve that. ============ ===================== Event Score variation ============ ===================== Event 1 +100 Event 2 -25 Event 3 -400 ============ ===================== I would be happy to switch to

How to right-align columns content in reStructuredText simple tables?

主宰稳场 提交于 2021-02-06 07:22:04
问题 I'm editing the documentation for a project of mine using Sphinx, which in turn uses reStructuredText as markup language. I have a simple table (as opposed to grid table ) in which the rightmost column reports contains numbers that I would like to right-align, but I couldn't find how to achieve that. ============ ===================== Event Score variation ============ ===================== Event 1 +100 Event 2 -25 Event 3 -400 ============ ===================== I would be happy to switch to

How to right-align columns content in reStructuredText simple tables?

你。 提交于 2021-02-06 07:20:59
问题 I'm editing the documentation for a project of mine using Sphinx, which in turn uses reStructuredText as markup language. I have a simple table (as opposed to grid table ) in which the rightmost column reports contains numbers that I would like to right-align, but I couldn't find how to achieve that. ============ ===================== Event Score variation ============ ===================== Event 1 +100 Event 2 -25 Event 3 -400 ============ ===================== I would be happy to switch to

How to right-align columns content in reStructuredText simple tables?

廉价感情. 提交于 2021-02-06 07:20:49
问题 I'm editing the documentation for a project of mine using Sphinx, which in turn uses reStructuredText as markup language. I have a simple table (as opposed to grid table ) in which the rightmost column reports contains numbers that I would like to right-align, but I couldn't find how to achieve that. ============ ===================== Event Score variation ============ ===================== Event 1 +100 Event 2 -25 Event 3 -400 ============ ===================== I would be happy to switch to