Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 902faaa

Browse files
committed
Docstring for Code class
1 parent a1097c7 commit 902faaa

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

IPython/lib/display.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,23 @@ def __repr__(self):
558558

559559

560560
class Code(TextDisplayObject):
561+
"""Display syntax-highlighted source code.
562+
563+
This uses Pygments to highlight the code for HTML and Latex output.
564+
565+
Parameters
566+
----------
567+
data : str
568+
The code as a string
569+
url : str
570+
A URL to fetch the code from
571+
filename : str
572+
A local filename to load the code from
573+
language : str
574+
The short name of a Pygments lexer to use for highlighting.
575+
If not specified, it will guess the lexer based on the filename
576+
or the code. Available lexers: http://pygments.org/docs/lexers/
577+
"""
561578
def __init__(self, data=None, url=None, filename=None, language=None):
562579
self.language = language
563580
super().__init__(data=data, url=url, filename=filename)

0 commit comments

Comments
 (0)