restructuredtext

How to create floating figures in reStructuredText / Sphinx?

情到浓时终转凉″ 提交于 2019-12-09 16:31:04
问题 I want to have a figure with text wrapped around it. This is what I'm saying: Installation of Optional Accessories ==================================== .. warning:: Never plug in or unplug a Hand Robot or a Grasp Sensor while the robot is turned on, as the system will not function properly and damage to the robot could occur. Installing a Hand Robot ----------------------- .. _`fig-attach-hand-robot`: .. figure:: attach-hand-robot.* :scale: 40% :align: right Attach Hand Robot Make sure the

Sphinx inline code highlight

旧时模样 提交于 2019-12-09 15:18:10
问题 I use Sphinx to make a website that contains code samples. I'm successful using the .. code-block directive to get syntax highlighting. But I can't get inline syntax highlighting using this code: .. role:: bash(code) :language: bash Test inline: :bash:`export FOO="bar"`. .. code-block:: bash export FOO="bar" which produces this output i.e. inline code not highlighted while block code is: Problem to me is that the generated HTML for inline code contains long class names while it does not for

Insert a link into bold text in reStructuredText

戏子无情 提交于 2019-12-09 14:16:23
问题 I try to insert a link into bold text in reStructuredText but failed. This is my rst source: **Lorem ipsum dolor sit amet, `consectetur <http://www.example.com>`_ adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.** but I got: <strong>Lorem ipsum dolor sit amet, `consectetur <http://www.example.com>`_ adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</strong> I want to get this: <strong>Lorem ipsum dolor sit amet, <a href=

Nested / Compounded roles: apply multiple roles to overlapping text

大城市里の小女人 提交于 2019-12-08 19:47:52
问题 In my custom.css file I have, .bold { font-weight: bold; } .red { color:red; } And in my _.rst file, .. role:: bold .. role:: red But if I try to nest/compound them, only the outermost role takes effect, e.g. :bold:`:red:`This is only bold`` This is only bold Is there a way to combine these effects without defining a new (combined) role? 回答1: you can use a custom css class directive: .. cssclass:: boldred bold red text and update the css to format the boldred class 回答2: Roles are defined that

Extracting blocks of text from ReST documents by :ref:?

对着背影说爱祢 提交于 2019-12-08 05:59:34
问题 I have some reStructuredText documentation. I would like to use snippets from it in online help. It seems like one approach would be to 'snip' out pieces of markup by reference, e.g. .. _my_boring_section: Introductory prose ------------------ blah blah blah .. _my_interesting_section: About this dialog ----------------- talk about stuff which is relevant in contextual help How could I use python/docutils/sphinx to extract the markup for the _my_interesting_section marker? 回答1: I'm not sure

Sphinx remove code formatting from custom code reference

假如想象 提交于 2019-12-07 22:01:16
问题 I have the following classes: class A: def x(): """ Do the thing. """ class B(A): def x(): """ Do the thing, but better than the :py:meth:`parent <A.x>` """ The entire module is autodoc ed. I would like to have a link to the parent implementation of x that renders as "parent", not as " parent ". How do I remove the code formatting from the custom method reference? The link itself is interpreted correctly based on the first rule of cross reference formats. Here is the generated HTML for the

sphinx, restructuredtext: color cell/row of a table

妖精的绣舞 提交于 2019-12-07 20:50:35
问题 Is there a way to color a specific row in a table in sphinx? I tryed using .. role:: which is related to a CSS file as discused in sphinx, restructuredtext: set color for a single word. However a :role: does not seem to work in a table. 回答1: No, but there is using the CSS selector :nth-child and applying a class to the parent table element. Then your custom CSS would be something like: table.myclass tr:nth-child(3) {color: red;} 来源: https://stackoverflow.com/questions/46193561/sphinx

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

坚强是说给别人听的谎言 提交于 2019-12-07 10:15:35
问题 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)

Embedding reStructuredText in Python docstrings

会有一股神秘感。 提交于 2019-12-07 06:45:00
问题 I'd like to see some nice syntax highlighting and colouring in my Python's docstrings which (of course) are valid RESt. For example: ''' A section ========= an example:: some code ''' rest of python code The closest I've got is this in my .vim/after/syntax/python.vim : syn include syntax/rst.vim syn region pythonDocstring start=+^\s*'''+ end=+'''+ contained According to the documentation of syntax-include that should be sufficient to. Also note that rst.vim re-defines a bunch of python

Using RestructuredText and Sphinx to include a preformatted file

旧城冷巷雨未停 提交于 2019-12-07 05:23:47
问题 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? 回答1: I think the .. literalinclude:: directive should give you what you want. 来源: https://stackoverflow.com/questions/2465080/using-restructuredtext-and