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