##// END OF EJS Templates
use traitlet for highlight_class
Jake Vanderplas -
Show More
@@ -20,6 +20,8 b' from pygments.formatters import HtmlFormatter'
20 from IPython.utils import path
20 from IPython.utils import path
21
21
22 from .activatable import ActivatableTransformer
22 from .activatable import ActivatableTransformer
23
24 from IPython.utils.traitlets import Unicode
23
25
24 #-----------------------------------------------------------------------------
26 #-----------------------------------------------------------------------------
25 # Classes and functions
27 # Classes and functions
@@ -33,6 +35,9 b' class CSSHtmlHeaderTransformer(ActivatableTransformer):'
33
35
34 header = []
36 header = []
35
37
38 highlight_class = Unicode('highlight', config=True,
39 help="CSS highlight class identifier")
40
36 def __init__(self, config=None, **kw):
41 def __init__(self, config=None, **kw):
37 """
42 """
38 Public constructor
43 Public constructor
@@ -97,8 +102,8 b' class CSSHtmlHeaderTransformer(ActivatableTransformer):'
97 pass
102 pass
98
103
99 #Add pygments CSS
104 #Add pygments CSS
100 highlight_class = '.' + self.config.get('highlight_class', 'highlight')
105 formatter = HtmlFormatter()
101 pygments_css = HtmlFormatter().get_style_defs(highlight_class)
106 pygments_css = formatter.get_style_defs('.' + self.highlight_class)
102 header.append(pygments_css)
107 header.append(pygments_css)
103
108
104 #Set header
109 #Set header
General Comments 0
You need to be logged in to leave comments. Login now