diff --git a/IPython/nbconvert/filters/markdown_mistune.py b/IPython/nbconvert/filters/markdown_mistune.py index 1ff83b6..e97c3b1 100644 --- a/IPython/nbconvert/filters/markdown_mistune.py +++ b/IPython/nbconvert/filters/markdown_mistune.py @@ -23,7 +23,7 @@ from IPython.utils.decorators import undoc @undoc class MathBlockGrammar(mistune.BlockGrammar): - block_math = re.compile("^\$\$([^\$]*?)\$\$", re.DOTALL) + block_math = re.compile(r"^\$\$(.*?)\$\$", re.DOTALL) latex_environment = re.compile(r"^\\begin\{([a-z]*\*?)\}(.*?)\\end\{\1\}", re.DOTALL) @@ -52,12 +52,13 @@ class MathBlockLexer(mistune.BlockLexer): @undoc class MathInlineGrammar(mistune.InlineGrammar): - math = re.compile("^\$([^\$]+?)\$") + math = re.compile(r"^\$(.+?)\$") + block_math = re.compile(r"^\$\$(.+?)\$\$", re.DOTALL) text = re.compile(r'^[\s\S]+?(?=[\\