From adb6d045b0df6ca6dbd77551ec27f650bf59a6b6 2014-04-23 09:03:15 From: Daniel B. Vasquez <danielpgb_vasquez@hotmail.com> Date: 2014-04-23 09:03:15 Subject: [PATCH] Pygment now adds a language-class to the highlighted html so that postprocessors can use it to identify the code block and the language of the code inside. --- diff --git a/IPython/nbconvert/filters/highlight.py b/IPython/nbconvert/filters/highlight.py index f1a373b..d52274e 100644 --- a/IPython/nbconvert/filters/highlight.py +++ b/IPython/nbconvert/filters/highlight.py @@ -3,7 +3,7 @@ Module containing filter functions that allow code to be highlighted from within Jinja templates. """ #----------------------------------------------------------------------------- -# Copyright (c) 2013, the IPython Development Team. +# Copyright (c) the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # @@ -56,7 +56,10 @@ class Highlight2HTML(NbConvertBase): if not language: language=self.default_language - return _pygments_highlight(source if len(source) > 0 else ' ', HtmlFormatter(), language, metadata) + return _pygments_highlight(source if len(source) > 0 else ' ', + # needed to help post processors: + HtmlFormatter(cssclass="hl-"+language), + language, metadata) class Highlight2Latex(NbConvertBase):