restructuredtext

Multi-line table cell in reStructuredText?

拥有回忆 提交于 2019-12-03 22:40:32
Is there a way to input a newline into a table cell? For example, say I have a table like this: +----------+----------+----------+ | Header 1 | Header 2 | Header 3 | +==========+==========+==========+ | Item 1 | | | | Item 2 | | | +----------+----------+----------+ I want the above to create a table with two rows, three columns, and the second row, first column to display Item 1 and Item 2 on separate lines. I have tried the line blocks syntax |, but it doesn't work inside a table cell. I can use list syntax, but I don't want bullet points to appear. First of all I think your table syntax is

Insert a link into bold text in reStructuredText

自闭症网瘾萝莉.ら 提交于 2019-12-03 22:37:55
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="http://www.example.com">consectetur</a> adipisicing elit, sed do eiusmod tempor incididunt ut labore et

Retaining inline code inside references in Sphinx

随声附和 提交于 2019-12-03 22:04:24
In Sphinx, if I have the following heading declaration: .. _somestuff: ``this is code``, this is not! ============================== It renders, like this: this is code , this is not! Which is good, but, if I use the reference, e.g: Have a look at :ref:`somestuff` It loses the code formatting and renders like: Have a look at this is code, this is not! instead of: Have a look at this is code , this is not! Is it possible to retain the code formatting in the reference? And how would I go about it? If you have a look at :ref: documentation in its official web site about inline markups: :ref: To

How to deal with duplicate target names in reStructuredText?

你离开我真会死。 提交于 2019-12-03 16:34:04
Example: foo is a tool used to do foo. Download_ .. _Download: http://example.com/foo blah blah blah (omit a lot of paragraphs) bar is another tool to do bar. Download_ .. _Download: http://example.com/bar Since Download points to different urls, docutilus gives this error report: Duplicate target name, cannot be used as a unique reference: "Download". While in markdown, I can specify different id for this two Download : [Download][download-foo] [download-foo]: http://example.com/foo [Download][download-bar] [download-bar]: http://example.com/bar How can I do similar things in reStructuredText

Image grid in reStructuredText / Sphinx

倾然丶 夕夏残阳落幕 提交于 2019-12-03 12:15:31
问题 I'm using Sphinx to create documentation for a Python project I'm working on. I have three images I would like to display in a 1x3 grid (i.e. all on the same line), and I'm trying to figure out how to do this in reStructuredText. Right now I have .. image:: _images/report_title.png .. image:: _images/report_slide1.png .. image:: _images/report_slide2.png I thought about trying to build one of the reST tables around them on a single line, but that seemed a little ridiculous. How can I grid

How to create custom directives in Sphinx

梦想与她 提交于 2019-12-03 11:46:51
问题 I'm currently documenting a rest API written in Python. All the project's documentation is created using Sphinx, and for the REST API I would like to create some special directives. For instance, let's say I have this resource defined: @resource("/user/<email>", method="GET") def user_details (email): """ Returns detailed information about a user account. :resource GET: /user/<email> :query_param a_param: Some kind of query param. """ # Do stuff and return user details That's basically how

How to do a link to a file in rst with sphinx?

前提是你 提交于 2019-12-03 11:33:30
问题 I am writing a documentation and I would like to include links to pdf files or zip archives. How can I achieve that using rst language and sphinx ? If I do that here is a pdf file : `pdf <doc/mypdf.pdf>`_ It does not work because, during the compilation sphinx do not copy the contains of the doc directory (I use the makefile generated by sphinx-quickstart). On the contrary, using the image directive : .. image:: img/plop.png sphinx does copy the plop.png image in build directory. How can I

How to embed HTML in restructured text file?

…衆ロ難τιáo~ 提交于 2019-12-03 10:24:59
问题 I'm using reStructuredText and I'd like to add HTML encoding an interactive flash-type animation through the <embed> tag. From my .rst document, how can I specify the position of this arbitrary chunk of HTML? Something like: .. html :: <embed> ... more html here ... </embed> Does this feature exist? thanks. 回答1: Try .. raw:: html <embed> ... </embed> The raw directive 来源: https://stackoverflow.com/questions/8621042/how-to-embed-html-in-restructured-text-file

How do I document :rtype: for a function that returns multiple possible data types? [duplicate]

空扰寡人 提交于 2019-12-03 06:26:08
This question already has answers here : How to specify multiple return types using type-hints (2 answers) In a Python docstring how should one document the :rtype: for a function that can return multiple possible data types? For example, if a function can return defaultdict OR dict OR list , based on the functions parameters, how do you document this? Code example: from collections import defaultdict def read_state(state_file, state_file_type='defaultdict'): """Deserialize state file or create empty state and return it. :param state_file: The path and file name of state file to read. :type

How do you get Python documentation in Texinfo Info format?

徘徊边缘 提交于 2019-12-03 02:54:13
问题 Since Python 2.6, it seems the documentation is in the new reStructuredText format, and it doesn't seem very easy to build a Texinfo Info file out of the box anymore. I'm an Emacs addict and prefer my documentation installed in Info. Does anyone have Python 2.6 or later docs in Texinfo format? How did you convert them? Or, is there a maintained build somewhere out there? I know I can use w3m or haddoc to view the html docs - I really want them in Info. I've played with Pandoc but after a few