Show More
@@ -39,7 +39,7 b' __all__ = [' | |||
|
39 | 39 | 'highlight2latex' |
|
40 | 40 | ] |
|
41 | 41 | |
|
42 |
def highlight2html(source, |
|
|
42 | def highlight2html(source, language='ipython', metadata=None): | |
|
43 | 43 | """ |
|
44 | 44 | Return a syntax-highlighted version of the input source as html output. |
|
45 | 45 | |
@@ -47,16 +47,16 b" def highlight2html(source, metadata=None, language='ipython'):" | |||
|
47 | 47 | ---------- |
|
48 | 48 | source : str |
|
49 | 49 | source of the cell to highlight. |
|
50 | metadata : NotebookNode cell metadata | |
|
51 | metadata of the cell to highlight. | |
|
52 | 50 | language : str |
|
53 | 51 | Language to highlight the syntax of. |
|
52 | metadata : NotebookNode cell metadata | |
|
53 | metadata of the cell to highlight. | |
|
54 | 54 | """ |
|
55 | 55 | |
|
56 |
return _pygment_highlight(source, HtmlFormatter(), |
|
|
56 | return _pygment_highlight(source, HtmlFormatter(), language, metadata) | |
|
57 | 57 | |
|
58 | 58 | |
|
59 |
def highlight2latex(source, |
|
|
59 | def highlight2latex(source, language='ipython', metadata=None): | |
|
60 | 60 | """ |
|
61 | 61 | Return a syntax-highlighted version of the input source as latex output. |
|
62 | 62 | |
@@ -64,16 +64,16 b" def highlight2latex(source, metadata=None, language='ipython'):" | |||
|
64 | 64 | ---------- |
|
65 | 65 | source : str |
|
66 | 66 | source of the cell to highlight. |
|
67 | metadata : NotebookNode cell metadata | |
|
68 | metadata of the cell to highlight. | |
|
69 | 67 | language : str |
|
70 | 68 | Language to highlight the syntax of. |
|
69 | metadata : NotebookNode cell metadata | |
|
70 | metadata of the cell to highlight. | |
|
71 | 71 | """ |
|
72 |
return _pygment_highlight(source, LatexFormatter(), |
|
|
72 | return _pygment_highlight(source, LatexFormatter(), language, metadata) | |
|
73 | 73 | |
|
74 | 74 | |
|
75 | 75 | |
|
76 |
def _pygment_highlight(source, output_formatter, |
|
|
76 | def _pygment_highlight(source, output_formatter, language='ipython', metadata=None): | |
|
77 | 77 | """ |
|
78 | 78 | Return a syntax-highlighted version of the input source |
|
79 | 79 | |
@@ -82,10 +82,10 b" def _pygment_highlight(source, output_formatter, metadata=None, language='ipytho" | |||
|
82 | 82 | source : str |
|
83 | 83 | source of the cell to highlight. |
|
84 | 84 | output_formatter : Pygments formatter |
|
85 | metadata : NotebookNode cell metadata | |
|
86 | metadata of the cell to highlight. | |
|
87 | 85 | language : str |
|
88 | 86 | Language to highlight the syntax of. |
|
87 | metadata : NotebookNode cell metadata | |
|
88 | metadata of the cell to highlight. | |
|
89 | 89 | """ |
|
90 | 90 | |
|
91 | 91 | # If the cell uses a magic extension language, |
General Comments 0
You need to be logged in to leave comments.
Login now