##// END OF EJS Templates
DOC: Define ipy directive as such in docs....
farisachugthai -
Show More
@@ -10,12 +10,15 b' IPython Sphinx Directive'
10 10 The IPython Sphinx Directive is in 'beta' and currently under
11 11 active development. Improvements to the code or documentation are welcome!
12 12
13 The ipython directive is a stateful ipython shell for embedding in
14 sphinx documents. It knows about standard ipython prompts, and
15 extracts the input and output lines. These prompts will be renumbered
16 starting at ``1``. The inputs will be fed to an embedded ipython
17 interpreter and the outputs from that interpreter will be inserted as
18 well. For example, code blocks like the following::
13 .. |rst| replace:: reStructured text
14
15 The :rst:dir:`ipython` directive is a stateful shell that can be used
16 in |rst| files.
17
18 It knows about standard ipython prompts, and extracts the input and output
19 lines. These prompts will be renumbered starting at ``1``. The inputs will be
20 fed to an embedded ipython interpreter and the outputs from that interpreter
21 will be inserted as well. For example, code blocks like the following::
19 22
20 23 .. ipython::
21 24
@@ -42,6 +45,48 b' will be rendered as'
42 45 document that generates the rendered output.
43 46
44 47
48 Directive and options
49 =====================
50
51 The IPython directive takes a number of options detailed here.
52
53 .. rst:directive:: ipython
54
55 Create an IPython directive.
56
57 .. rst:directive:option:: doctest
58
59 Run a doctest on IPython code blocks in rst.
60
61 .. rst:directive:option:: python
62
63 Used to indicate that the relevant code block does not have IPython prompts.
64
65 .. rst:directive:option:: okexcept
66
67 Allow the code block to raise an exception.
68
69 .. rst:directive:option:: okwarning
70
71 Allow the code block to emit an warning.
72
73 .. rst:directive:option:: suppress
74
75 Silence any warnings or expected errors.
76
77 .. rst:directive:option:: verbatim
78
79 A noop that allows for any text to be syntax highlighted as valid IPython code.
80
81 .. rst:directive:option:: savefig: OUTFILE [IMAGE_OPTIONS]
82
83 Save output from matplotlib to *outfile*.
84
85 It's important to note that all of these options can be used for the entire
86 directive block or they can decorate individual lines of code as explained
87 in :ref:`pseudo-decorators`.
88
89
45 90 Persisting the Python session across IPython directive blocks
46 91 =============================================================
47 92
@@ -393,6 +438,8 b' Pretty much anything you can do with the ipython code, you can do with'
393 438 with a simple python script. Obviously, though it doesn't make sense
394 439 to use the doctest option.
395 440
441 .. _pseudo-decorators:
442
396 443 Pseudo-Decorators
397 444 =================
398 445
General Comments 0
You need to be logged in to leave comments. Login now