restructuredtext

How to create custom directives in Sphinx

跟風遠走 提交于 2019-12-03 02:10:44
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 the documentation currently looks. I would like to be able to create a directive for Sphinx that formats

How to embed HTML in restructured text file?

吃可爱长大的小学妹 提交于 2019-12-03 00:53:47
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. Try .. raw:: html <embed> ... </embed> The raw directive 来源: https://stackoverflow.com/questions/8621042/how-to-embed-html-in-restructured-text-file

Are there any real alternatives to reStructuredText for Python documentation? [closed]

空扰寡人 提交于 2019-12-03 00:53:13
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I'm starting an open source Python project shortly and I'm trying to decide in advance how to write my docstrings. The obvious answer would be using reStructuredText and Sphinx with autodoc, because I really like the idea of simply properly documenting my code in my docstrings then have Sphinx automatically

How to create a nested list in reStructuredText?

六月ゝ 毕业季﹏ 提交于 2019-12-02 21:32:30
I am trying to create a properly nested list using the following code (following Sphinx and docutils docs): 1. X a. U b. V c. W 2. Y 3. Z I expect this to result in two OL s but I get the following output instead: <ol class="arabic simple"> <li>X</li> </ol> <blockquote> <div> <ol class="loweralpha simple"> <li>U</li> <li>V</li> <li>W</li> </ol> </div> </blockquote> <ol class="arabic simple" start="2"> <li>Y</li> <li>Z</li> </ol> What am I doing wrong? Is it not possible to get the following result? <ol class="arabic simple"> <li>X <ol class="loweralpha simple"> <li>U</li> <li>V</li> <li>W</li>

Sphinx, reStructuredText show/hide code snippets

僤鯓⒐⒋嵵緔 提交于 2019-12-02 18:41:27
I've been documenting a software package using Sphinx and reStructuredText . Within my documents, there are some long code snippets. I want to be able to have them hidden as default, with a little "Show/Hide" button that would expand them ( Example ). Is there a standard way to do that? Kevin Horn I think the easiest way to do this would be to create a custom Sphinx theme in which you tell certain html elements to have this functionality. A little JQuery would go a long way here. If, however you want to be able to specify this in your reStructuredText markup, you would need to either get such

How do you get Python documentation in Texinfo Info format?

≡放荡痞女 提交于 2019-12-02 16:45:40
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 small experiments it doesn't seem to deal well with links between documents, and my larger experiment -

Are there any real alternatives to reStructuredText for Python documentation? [closed]

好久不见. 提交于 2019-12-02 14:16:56
I'm starting an open source Python project shortly and I'm trying to decide in advance how to write my docstrings. The obvious answer would be using reStructuredText and Sphinx with autodoc, because I really like the idea of simply properly documenting my code in my docstrings then have Sphinx automatically construct an API doc for me. The problem is the reStructuredText syntax it uses - I think it's completely unreadable before it's rendered. For instance: :param path: The path of the file to wrap :type path: str :param field_storage: The :class:`FileStorage` instance to wrap :type field

Compare and contrast the lightweight markup languages [closed]

情到浓时终转凉″ 提交于 2019-12-02 13:49:35
Please identify the most popular lightweight markup languages and compare their strengths and weaknesses. These languages should be general-purpose markup for technical prose, such as for documentation (for example, Haml doesn't count). See also: Markdown versus ReStructuredText JasonSmith I know of three main languages used commonly in the greater programming and tech community: Textile, Markdown, and reStructuredText. All three can be learned in a couple of hours or "winged" with the cheat sheet nearby. Textile Used by Redmine and the Ruby community 113 questions currently tagged on Stack

How to add anchor in list element

家住魔仙堡 提交于 2019-12-02 08:49:11
问题 I have a list in my rst file that looks like this: - Item 1 - Item 2 - Item 3 It renders something like the following (which is exactly what I want): Item 1 Item 2 Item 3 I would like to create links for each item, so I did .. _item-1: - Item 1 .. _item-1: - Item 2 .. _item-1: - Item 3 Now my list renders something like this: Item 1 Item 2 Item 3 This is clearly happening because of the anchors I inserted between the elements. Is there a way to insert referenc-able anchors inline in sphinx

End literal block in list item

匆匆过客 提交于 2019-12-02 06:05:35
I have a list item in my rst file that I would like to put a literal block into, but I am unable to get the literal block to end properly. This is my rst: 1. Item 1 (not literal) 2. Item 2:: MyCode.example() Description of the code shown above (not literal) I would like the paragraph starting with Description to be outside the literal block above it, but still part of list item #2. The only workaround I have been able to come up with is this: 1. Item 1 (not literal) 2. Item 2: :: MyCode.example() Description of the code shown above (not literal) This allows the non-literal text to return to