##// END OF EJS Templates
Cherry pick of @jasongrout 's 2bc2f96....
Cherry pick of @jasongrout 's 2bc2f96. Only merged changes to notebook and kernel... (see original comment below). Separate the widget registry from the widget managers; attach widget managers to kernels. Yet to do: take care of clean-up when a kernel is deleted Conflicts: IPython/html/static/notebook/js/widgetmanager.js IPython/html/static/notebook/js/widgets/widget.js

File last commit:

r11294:1316de0d
r14622:43cee970
Show More
markdown.py
74 lines | 2.0 KiB | text/x-python | PythonLexer
"""Markdown filters
This file contains a collection of utility filters for dealing with
markdown within Jinja templates.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from __future__ import print_function
# Stdlib imports
import sys
import subprocess
from IPython.nbconvert.utils.pandoc import pandoc
#-----------------------------------------------------------------------------
# Functions
#-----------------------------------------------------------------------------
__all__ = [
'markdown2html',
'markdown2latex',
'markdown2rst'
]
def markdown2latex(source):
"""Convert a markdown string to LaTeX via pandoc.
This function will raise an error if pandoc is not installed.
Any error messages generated by pandoc are printed to stderr.
Parameters
----------
source : string
Input string, assumed to be valid markdown.
Returns
-------
out : string
Output as returned by pandoc.
"""
return pandoc(source, 'markdown', 'latex')
def markdown2html(source):
"""Convert a markdown string to HTML via pandoc"""
return pandoc(source, 'markdown', 'html', extra_args=['--mathjax'])
def markdown2rst(source):
"""Convert a markdown string to LaTeX via pandoc.
This function will raise an error if pandoc is not installed.
Any error messages generated by pandoc are printed to stderr.
Parameters
----------
source : string
Input string, assumed to be valid markdown.
Returns
-------
out : string
Output as returned by pandoc.
"""
return pandoc(source, 'markdown', 'rst')