Show More
@@ -23,7 +23,7 b' from IPython.utils.decorators import undoc' | |||
|
23 | 23 | |
|
24 | 24 | @undoc |
|
25 | 25 | class MathBlockGrammar(mistune.BlockGrammar): |
|
26 |
block_math = re.compile("^\$\$( |
|
|
26 | block_math = re.compile(r"^\$\$(.*?)\$\$", re.DOTALL) | |
|
27 | 27 | latex_environment = re.compile(r"^\\begin\{([a-z]*\*?)\}(.*?)\\end\{\1\}", |
|
28 | 28 | re.DOTALL) |
|
29 | 29 | |
@@ -52,12 +52,13 b' class MathBlockLexer(mistune.BlockLexer):' | |||
|
52 | 52 | |
|
53 | 53 | @undoc |
|
54 | 54 | class MathInlineGrammar(mistune.InlineGrammar): |
|
55 |
math = re.compile("^\$( |
|
|
55 | math = re.compile(r"^\$(.+?)\$") | |
|
56 | block_math = re.compile(r"^\$\$(.+?)\$\$", re.DOTALL) | |
|
56 | 57 | text = re.compile(r'^[\s\S]+?(?=[\\<!\[_*`~$]|https?://| {2,}\n|$)') |
|
57 | 58 | |
|
58 | 59 | @undoc |
|
59 | 60 | class MathInlineLexer(mistune.InlineLexer): |
|
60 | default_rules = ['math'] + mistune.InlineLexer.default_rules | |
|
61 | default_rules = ['math', 'block_math'] + mistune.InlineLexer.default_rules | |
|
61 | 62 | |
|
62 | 63 | def __init__(self, renderer, rules=None, **kwargs): |
|
63 | 64 | if rules is None: |
@@ -67,6 +68,9 b' class MathInlineLexer(mistune.InlineLexer):' | |||
|
67 | 68 | def output_math(self, m): |
|
68 | 69 | return self.renderer.inline_math(m.group(1)) |
|
69 | 70 | |
|
71 | def output_block_math(self, m): | |
|
72 | return self.renderer.block_math(m.group(1)) | |
|
73 | ||
|
70 | 74 | @undoc |
|
71 | 75 | class MarkdownWithMath(mistune.Markdown): |
|
72 | 76 | def __init__(self, renderer, **kwargs): |
General Comments 0
You need to be logged in to leave comments.
Login now