restructuredtext

Managing Sphinx toctrees combined with inline sections

半城伤御伤魂 提交于 2021-02-20 04:51:14
问题 I'm trying to learn how I can manage a toctree element that is located in the same file as other content. Suppose I have a thingamajig.rst chapter that looks like this: Thingamajigs ============ .. toctree:: :maxdepth: 2 foo bar baz Overview ++++++++ Thingamajigs are fun When I render it --- foo/bar/baz have their own .rst files --- it looks like this: But if I move the Overview section before the toctree, then it pushes the toctree down into the Overview section: Thingamajigs ============

Custom Syntax Highlighting with Sphinx

蹲街弑〆低调 提交于 2021-02-18 05:24:44
问题 I am interested in creating a custom syntax highlighter that can be used in a Sphinx environment. Is this possible? If so how would I go about doing it? 回答1: Background Sphinx (http://sphinx-doc.org/) internally uses Pygments (http://pygments.org/) as a syntax highligher. Pygments supports adding custom syntax highlighter (lexer) as described here http://pygments.org/docs/lexerdevelopment/. Example usage I would try to define a new custom lexer in Pygments and initialize that new custom lexer

How to make toctree link refer to the separate file like it refers to the subsections

喜你入骨 提交于 2021-02-15 16:35:49
问题 Structure The following structure of the project: index.rst MyProject ========= Contents: .. toctree:: group1 group1.rst Group1 ------ Subgroup1 ========= Subgroup1 contents Subgroup2 ========= Subgroup2 contents Rendered to (after clicking on Group1 -> Subgroup2 ): As you can see it opens the Group1 page and linked to Subgroup2 section. Want I want to have the same on the left side ( Group1 openned and Subgroup2 choosed) but on the right side I want to see only Subgroup2 page (page without

How to make toctree link refer to the separate file like it refers to the subsections

﹥>﹥吖頭↗ 提交于 2021-02-15 16:33:32
问题 Structure The following structure of the project: index.rst MyProject ========= Contents: .. toctree:: group1 group1.rst Group1 ------ Subgroup1 ========= Subgroup1 contents Subgroup2 ========= Subgroup2 contents Rendered to (after clicking on Group1 -> Subgroup2 ): As you can see it opens the Group1 page and linked to Subgroup2 section. Want I want to have the same on the left side ( Group1 openned and Subgroup2 choosed) but on the right side I want to see only Subgroup2 page (page without

How to make toctree link refer to the separate file like it refers to the subsections

纵然是瞬间 提交于 2021-02-15 16:31:10
问题 Structure The following structure of the project: index.rst MyProject ========= Contents: .. toctree:: group1 group1.rst Group1 ------ Subgroup1 ========= Subgroup1 contents Subgroup2 ========= Subgroup2 contents Rendered to (after clicking on Group1 -> Subgroup2 ): As you can see it opens the Group1 page and linked to Subgroup2 section. Want I want to have the same on the left side ( Group1 openned and Subgroup2 choosed) but on the right side I want to see only Subgroup2 page (page without

Create automatic numbering for items in Sphinx reStructuredText

独自空忆成欢 提交于 2021-02-11 13:59:57
问题 I am preparing a training manual for which I have different types of activities. I am looking to have a way to automatically number them. Something like: Task 1, Task 2, Task n... I saw examples of how to create lists, but what I want is not quite the same. I guess I am looking for some kind of constructor that allows something like: 'description' + 'number' 来源: https://stackoverflow.com/questions/62936118/create-automatic-numbering-for-items-in-sphinx-restructuredtext

Create automatic numbering for items in Sphinx reStructuredText

☆樱花仙子☆ 提交于 2021-02-11 13:57:20
问题 I am preparing a training manual for which I have different types of activities. I am looking to have a way to automatically number them. Something like: Task 1, Task 2, Task n... I saw examples of how to create lists, but what I want is not quite the same. I guess I am looking for some kind of constructor that allows something like: 'description' + 'number' 来源: https://stackoverflow.com/questions/62936118/create-automatic-numbering-for-items-in-sphinx-restructuredtext

Python convert sphinx RST to HTML

北战南征 提交于 2021-02-10 02:55:27
问题 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?

Python convert sphinx RST to HTML

﹥>﹥吖頭↗ 提交于 2021-02-10 02:48:45
问题 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?

Python convert sphinx RST to HTML

不问归期 提交于 2021-02-10 02:47:49
问题 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?