Show More
@@ -1550,11 +1550,13 b' class InteractiveShell(SingletonConfigurable):' | |||
|
1550 | 1550 | """ |
|
1551 | 1551 | info = self._object_find(oname, namespaces) |
|
1552 | 1552 | docformat = sphinxify if self.sphinxify_docstring else None |
|
1553 | print("using docformat", docformat, self.sphinxify_docstring, sphinxify) | |
|
1553 | 1554 | if info.found: |
|
1554 | 1555 | pmethod = getattr(self.inspector, meth) |
|
1555 | 1556 | # TODO: only apply format_screen to the plain/text repr of the mime |
|
1556 | 1557 | # bundle. |
|
1557 | 1558 | formatter = format_screen if info.ismagic else docformat |
|
1559 | print("usingformatter", formatter) | |
|
1558 | 1560 | if meth == 'pdoc': |
|
1559 | 1561 | pmethod(info.obj, oname, formatter) |
|
1560 | 1562 | elif meth == 'pinfo': |
@@ -44,6 +44,13 b' from IPython.utils.py3compat import cast_unicode, string_types, PY3' | |||
|
44 | 44 | from IPython.utils.signatures import signature |
|
45 | 45 | from IPython.utils.colorable import Colorable |
|
46 | 46 | |
|
47 | from pygments import highlight | |
|
48 | from pygments.lexers import PythonLexer | |
|
49 | from pygments.formatters import HtmlFormatter | |
|
50 | ||
|
51 | def pylight(code): | |
|
52 | return highlight(code, PythonLexer(), HtmlFormatter(noclasses=True)) | |
|
53 | ||
|
47 | 54 | # builtin docstrings to ignore |
|
48 | 55 | _func_call_docstring = types.FunctionType.__call__.__doc__ |
|
49 | 56 | _object_init_docstring = object.__init__.__doc__ |
@@ -365,14 +372,6 b' def find_source_lines(obj):' | |||
|
365 | 372 | |
|
366 | 373 | return lineno |
|
367 | 374 | |
|
368 | from pygments import highlight | |
|
369 | from pygments.lexers import PythonLexer | |
|
370 | from pygments.formatters import HtmlFormatter | |
|
371 | ||
|
372 | def pylight(code): | |
|
373 | return highlight(code, PythonLexer(), HtmlFormatter(noclasses=True)) | |
|
374 | ||
|
375 | ||
|
376 | 375 | class Inspector(Colorable): |
|
377 | 376 | |
|
378 | 377 | def __init__(self, color_table=InspectColors, |
@@ -41,3 +41,46 b' IPython itself.' | |||
|
41 | 41 | the `PromptManager` class have been removed, and the prompt machinery simplified. |
|
42 | 42 | See `TerminalINteractiveShell.prompts` configurable for how to setup your prompts. |
|
43 | 43 | |
|
44 | ||
|
45 | ||
|
46 | Provisional Changes | |
|
47 | ------------------- | |
|
48 | ||
|
49 | Provisional changes are in experimental functionality that may, or may not make | |
|
50 | it to future version of IPython, and which API may change without warnings. | |
|
51 | Activating these feature and using these API is at your own risk, and may have | |
|
52 | security implication for your system, especially if used with the Jupyter notebook, | |
|
53 | ||
|
54 | When running via the Jupyter notebook interfaces, or other compatible client, | |
|
55 | you can enable rich documentation experimental functionality: | |
|
56 | ||
|
57 | When the ``docrepr`` package is installed setting the boolean flag | |
|
58 | ``InteractiveShell.sphinxify_docstring`` to ``True``, will process the various | |
|
59 | object through sphinx before displaying them (see the ``docrepr`` package | |
|
60 | documentation for more information. | |
|
61 | ||
|
62 | You need to also enable the IPython pager display rich HTML representation | |
|
63 | using the ``InteractiveShell.enable_html_pager`` boolean configuration option. | |
|
64 | As usual you can set these configuration options globally in your configuration | |
|
65 | files, alternatively you can turn them on dynamically using the following | |
|
66 | snippet: | |
|
67 | ||
|
68 | .. code-block:: python | |
|
69 | ||
|
70 | ip = get_ipython() | |
|
71 | ip.sphinxify_docstring = True | |
|
72 | ip.enable_html_pager = True | |
|
73 | ||
|
74 | You can test the effect of various combinations of the above configuration in | |
|
75 | the Jupyter notebook, with things example like : | |
|
76 | ||
|
77 | .. code-block:: python | |
|
78 | ||
|
79 | import numpy as np | |
|
80 | np.histogram? | |
|
81 | ||
|
82 | This is part of an effort to make Documentation in Python richer and provide in | |
|
83 | the long term if possible dynamic examples that can contain math, images, | |
|
84 | widgets... As stated above this is nightly experimental feature with a lot of | |
|
85 | (fun) problem to solve. We would be happy to get your feedback and expertise on | |
|
86 | it. |
General Comments 0
You need to be logged in to leave comments.
Login now