Show More
@@ -23,6 +23,7 b' from pygments.util import ClassNotFound' | |||||
23 | # IPython imports |
|
23 | # IPython imports | |
24 | from IPython.nbconvert.utils.pandoc import pandoc |
|
24 | from IPython.nbconvert.utils.pandoc import pandoc | |
25 | from IPython.nbconvert.utils.exceptions import ConversionException |
|
25 | from IPython.nbconvert.utils.exceptions import ConversionException | |
|
26 | from IPython.utils.decorators import undoc | |||
26 | from IPython.utils.process import get_output_error_code |
|
27 | from IPython.utils.process import get_output_error_code | |
27 | from IPython.utils.py3compat import cast_bytes |
|
28 | from IPython.utils.py3compat import cast_bytes | |
28 | from IPython.utils.version import check_version |
|
29 | from IPython.utils.version import check_version | |
@@ -62,11 +63,14 b' def markdown2latex(source):' | |||||
62 | """ |
|
63 | """ | |
63 | return pandoc(source, 'markdown', 'latex') |
|
64 | return pandoc(source, 'markdown', 'latex') | |
64 |
|
65 | |||
|
66 | ||||
|
67 | @undoc | |||
65 | class MathBlockGrammar(mistune.BlockGrammar): |
|
68 | class MathBlockGrammar(mistune.BlockGrammar): | |
66 | block_math = re.compile("^\$\$(.*?)\$\$", re.DOTALL) |
|
69 | block_math = re.compile("^\$\$(.*?)\$\$", re.DOTALL) | |
67 | latex_environment = re.compile(r"^\\begin\{([a-z]*\*?)\}(.*?)\\end\{\1\}", |
|
70 | latex_environment = re.compile(r"^\\begin\{([a-z]*\*?)\}(.*?)\\end\{\1\}", | |
68 | re.DOTALL) |
|
71 | re.DOTALL) | |
69 |
|
72 | |||
|
73 | @undoc | |||
70 | class MathBlockLexer(mistune.BlockLexer): |
|
74 | class MathBlockLexer(mistune.BlockLexer): | |
71 | default_features = ['block_math', 'latex_environment'] + mistune.BlockLexer.default_features |
|
75 | default_features = ['block_math', 'latex_environment'] + mistune.BlockLexer.default_features | |
72 |
|
76 | |||
@@ -89,9 +93,11 b' class MathBlockLexer(mistune.BlockLexer):' | |||||
89 | 'text': m.group(2) |
|
93 | 'text': m.group(2) | |
90 | }) |
|
94 | }) | |
91 |
|
95 | |||
|
96 | @undoc | |||
92 | class MathInlineGrammar(mistune.InlineGrammar): |
|
97 | class MathInlineGrammar(mistune.InlineGrammar): | |
93 | math = re.compile("^\$(.+?)\$") |
|
98 | math = re.compile("^\$(.+?)\$") | |
94 |
|
99 | |||
|
100 | @undoc | |||
95 | class MathInlineLexer(mistune.InlineLexer): |
|
101 | class MathInlineLexer(mistune.InlineLexer): | |
96 | default_features = ['math'] + mistune.InlineLexer.default_features |
|
102 | default_features = ['math'] + mistune.InlineLexer.default_features | |
97 |
|
103 | |||
@@ -103,6 +109,7 b' class MathInlineLexer(mistune.InlineLexer):' | |||||
103 | def output_math(self, m): |
|
109 | def output_math(self, m): | |
104 | return self.renderer.inline_math(m.group(1)) |
|
110 | return self.renderer.inline_math(m.group(1)) | |
105 |
|
111 | |||
|
112 | @undoc | |||
106 | class MarkdownWithMath(mistune.Markdown): |
|
113 | class MarkdownWithMath(mistune.Markdown): | |
107 | def __init__(self, renderer, **kwargs): |
|
114 | def __init__(self, renderer, **kwargs): | |
108 | if 'inline' not in kwargs: |
|
115 | if 'inline' not in kwargs: | |
@@ -117,6 +124,7 b' class MarkdownWithMath(mistune.Markdown):' | |||||
117 | def parse_latex_environment(self): |
|
124 | def parse_latex_environment(self): | |
118 | return self.renderer.latex_environment(self.token['name'], self.token['text']) |
|
125 | return self.renderer.latex_environment(self.token['name'], self.token['text']) | |
119 |
|
126 | |||
|
127 | @undoc | |||
120 | class IPythonRenderer(mistune.Renderer): |
|
128 | class IPythonRenderer(mistune.Renderer): | |
121 | def block_code(self, code, lang): |
|
129 | def block_code(self, code, lang): | |
122 | if lang: |
|
130 | if lang: |
@@ -23,6 +23,8 b" if __name__ == '__main__':" | |||||
23 | r'\.config\.profile', |
|
23 | r'\.config\.profile', | |
24 | # These should be accessed via nbformat.current |
|
24 | # These should be accessed via nbformat.current | |
25 | r'\.nbformat\.v\d+', |
|
25 | r'\.nbformat\.v\d+', | |
|
26 | # Public API for this is in kernel.zmq.eventloops | |||
|
27 | r'\.kernel\.zmq\.gui', | |||
26 | ] |
|
28 | ] | |
27 |
|
29 | |||
28 | # The inputhook* modules often cause problems on import, such as trying to |
|
30 | # The inputhook* modules often cause problems on import, such as trying to |
General Comments 0
You need to be logged in to leave comments.
Login now