##// END OF EJS Templates
keep .highlight css class...
MinRK -
Show More
@@ -2,41 +2,23 b''
2 Module containing filter functions that allow code to be highlighted
2 Module containing filter functions that allow code to be highlighted
3 from within Jinja templates.
3 from within Jinja templates.
4 """
4 """
5 #-----------------------------------------------------------------------------
6 # Copyright (c) the IPython Development Team.
7 #
8 # Distributed under the terms of the Modified BSD License.
9 #
10 # The full license is in the file COPYING.txt, distributed with this software.
11 #-----------------------------------------------------------------------------
12
5
13 #-----------------------------------------------------------------------------
6 # Copyright (c) IPython Development Team.
14 # Imports
7 # Distributed under the terms of the Modified BSD License.
15 #-----------------------------------------------------------------------------
16
8
17 # pygments must not be imported at the module level
9 # pygments must not be imported at the module level
18 # because errors should be raised at runtime if it's actually needed,
10 # because errors should be raised at runtime if it's actually needed,
19 # not import time, when it may not be needed.
11 # not import time, when it may not be needed.
20
12
21 # Our own imports
22 from IPython.nbconvert.utils.base import NbConvertBase
13 from IPython.nbconvert.utils.base import NbConvertBase
23
14
24 #-----------------------------------------------------------------------------
25 # Globals and constants
26 #-----------------------------------------------------------------------------
27
28 MULTILINE_OUTPUTS = ['text', 'html', 'svg', 'latex', 'javascript', 'json']
15 MULTILINE_OUTPUTS = ['text', 'html', 'svg', 'latex', 'javascript', 'json']
29
16
30 #-----------------------------------------------------------------------------
31 # Utility functions
32 #-----------------------------------------------------------------------------
33
34 __all__ = [
17 __all__ = [
35 'Highlight2HTML',
18 'Highlight2HTML',
36 'Highlight2Latex'
19 'Highlight2Latex'
37 ]
20 ]
38
21
39
40 class Highlight2HTML(NbConvertBase):
22 class Highlight2HTML(NbConvertBase):
41
23
42 def __call__(self, source, language=None, metadata=None):
24 def __call__(self, source, language=None, metadata=None):
@@ -58,7 +40,7 b' class Highlight2HTML(NbConvertBase):'
58
40
59 return _pygments_highlight(source if len(source) > 0 else ' ',
41 return _pygments_highlight(source if len(source) > 0 else ' ',
60 # needed to help post processors:
42 # needed to help post processors:
61 HtmlFormatter(cssclass="hl-"+language),
43 HtmlFormatter(cssclass=" highlight hl-"+language),
62 language, metadata)
44 language, metadata)
63
45
64
46
General Comments 0
You need to be logged in to leave comments. Login now