def custom_highlighter(source, language='ipython', metadata=None): """ Makes the syntax highlighting from pygments have prefix(`highlight-ipynb`) So it doesn't break the theme pygments It modifies both css prefixes and html tags """ if not language: language = 'ipython' formatter = HtmlFormatter(cssclass='highlight-ipynb') output = _pygments_highlight(source, formatter, language, metadata) output = output.replace('<pre>', '<pre class="ipynb">') return output
def custom_highlighter(source, language='ipython', metadata=None): """ Makes the syntax highlighting from pygments have prefix(`highlight-ipynb`) So it doesn't break the theme pygments It modifies both css prefixes and html tags """ if not language: language = 'ipython' formatter = HtmlFormatter(cssclass='highlight-ipynb') output = _pygments_highlight(source, formatter, language, metadata) output = output.replace('<pre>', '<pre class="ipynb">') return output
def custom_highlighter(source, language="ipython", metadata=None): """ Makes the syntax highlighting from pygments have prefix(`highlight-ipynb`) So it does not break the theme pygments It modifies both the css and html """ if not language: language = "ipython" formatter = HtmlFormatter(cssclass="highlight-ipynb") output = _pygments_highlight(source, formatter, language, metadata) output = output.replace("<pre>", '<pre class="ipynb">') return output
def custom_highlighter(source, language='ipython', metadata=None): formatter = HtmlFormatter(cssclass='highlight-ipynb') if not language: language = 'ipython' output = _pygments_highlight(source, formatter, language) return output.replace('<pre>', '<pre class="ipynb">')
def custom_highlighter(source, language='ipython', metadata=None): formatter = HtmlFormatter(cssclass='highlight-ipynb') if not language: language = 'ipython' output = _pygments_highlight(source, formatter, language) return output.replace('<pre>', '<pre class="ipynb">')