restructuredtext

how to document a single space character within a string in reST/Sphinx?

自闭症网瘾萝莉.ら 提交于 2019-12-10 17:49:37
问题 I've gotten lost in an edge case of sorts. I'm working on a conversion of some old plaintext documentation to reST/Sphinx format, with the intent of outputting to a few formats (including HTML and text) from there. Some of the documented functions are for dealing with bitstrings, and a common case within these is a sentence like the following: Starting character is the blank " " which has the value 0. I tried writing this as an inline literal the following ways: Starting character is the

How to separate Sphinx chapters within a single part into different files?

泄露秘密 提交于 2019-12-10 17:12:15
问题 I'm using the wonderful Sphinx tool to create some documentation and I'm trying to keep the codebase in a modular form by separating chapters of the same part into separate files. (See here for definitions of 'chapter' and 'part'.) I've tried to do this using two files, test1.rst : ###### Part 1 ###### ********* Chapter 1 ********* Section 1 ========= Test Content 1. and test2.rst : ********* Chapter 2 ********* Section 2 ========= Test Content 2. They are included in index.rst like this: ..

sphinx remove chapter title in my pdf with latexpdf?

梦想与她 提交于 2019-12-10 14:34:13
问题 I generate a documentation from rst to pdf with latexpdf and sphinx. How can I remove chapter title before every chapter? ----------- CHAPTER ONE ----------- 回答1: As noted in the sphinx documentation you can change the latex_documents documentclass to a howto documentclass, which will get rid of the "Chaper" before your section. However, this will also change formatting slightly for the whole build. documentclass: Normally, one of 'manual' or 'howto' (provided by Sphinx). Other document

How to edit Sidebar under Sphinx Alabaster theme

亡梦爱人 提交于 2019-12-10 13:37:09
问题 I have the following index.rst file. Know the cell population of your data ===================================== Some content .. toctree:: :maxdepth: 2 Installation ~~~~~~~~~~~~ .. toctree:: :maxdepth: 2 installation Scripts ~~~~~~~ .. toctree:: :maxdepth: 2 scripts API documentation ~~~~~~~~~~~~~~~~~ .. toctree:: :maxdepth: 2 apidoc Roadmap ~~~~~~~ .. toctree:: :maxdepth: 2 roadmap Indices and Tables ================== * :ref: `genindex` Now the sidebar looks like this: As described in that

Can I use inline raw LaTeX in reStructuredText

 ̄綄美尐妖づ 提交于 2019-12-10 13:14:19
问题 I am trying to embed a LaTeX variable into some reStructuredText. I know about the ".. raw::" directive, but I want this to be embedded in a paragraph of text. Specifically, I am looking to replicate the \numquestions\ and \numpoints\ variables from the template exam document. I have tried using :raw: \numquestions\ , but this does not seem to be valid. Is there any way of doing this? 回答1: You first have to define your own latex role, which allows you then to embed LaTex directly into

Use ReStructuredText for pretty source code listing

一曲冷凌霜 提交于 2019-12-10 09:32:35
问题 As is asked and answered in this post, one can use SyntaxHighlighter for pretty code listing. With ReStructuredText, I can use raw directive as follows. .. raw:: html <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js"></script> <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js"></script> <link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shCoreDefault.css

How to add rst format in nodes for directive?

天大地大妈咪最大 提交于 2019-12-10 09:25:41
问题 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 ] 回答1: 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

Writing terms in plural without the redundancy

北城余情 提交于 2019-12-10 04:26:51
问题 I often have the situation that I want to link a term to the glossary but state the term in plural. So normally you do something like this in singular: Some text before the term :term:`important word` then the stuff after the term This is considered a completely different term: Some text before the term :term:`important words` then the stuff after the term This doesn't get parsed: Some text before the term :term:`important word`s then the stuff after the term And this is very redundant (but

How to correctly include other ReST-files in a sphinx-project?

拈花ヽ惹草 提交于 2019-12-10 02:39:04
问题 My hand-written documentation/user-guide (written in ReStructuredText with sphinx) has become quite big so I started organize my .rst-files in sub-directories. In the index.rst I'm including a subindex.rst of each sub-directory which itselfs includes other .rst -files for further sub-directories. index.rst : .. include:: subdir1/subindex.rst .. include:: subdir2/subindex.rst subdir1/subindex.rst : .. include:: file1.rst .. include:: file2.rst In principle this works well, except that sphinx

reStructuredText: README.rst not parsing on PyPI

心不动则不痛 提交于 2019-12-10 02:06:29
问题 I have a Python project that is hosted on both Github and PyPI. On Github: https://github.com/sloria/TextBlob/blob/master/README.rst On PyPi: https://pypi.python.org/pypi/textblob My README.rst doesn't seem to be formatting correctly on PyPI, but it looks fine on Github. I have already read this, but I don't have any in-page links, so that's not the problem. 回答1: You are using a newer text role, :code:. PyPI appears to only support docutils 0.8, with code and code-block added to the PyPI