##// END OF EJS Templates
Add support for \begin foo \end math blocks
Thomas Kluyver -
Show More
@@ -72,9 +72,10 b' def markdown2latex(source):'
72
72
73 class MathBlockGrammar(mistune.BlockGrammar):
73 class MathBlockGrammar(mistune.BlockGrammar):
74 block_math = re.compile("^\$\$(.*?)\$\$")
74 block_math = re.compile("^\$\$(.*?)\$\$")
75 block_math2 = re.compile(r"^\\begin(.*?)\\end")
75
76
76 class MathBlockLexer(mistune.BlockLexer):
77 class MathBlockLexer(mistune.BlockLexer):
77 default_features = ['block_math'] + mistune.BlockLexer.default_features
78 default_features = ['block_math', 'block_math2'] + mistune.BlockLexer.default_features
78
79
79 def __init__(self, rules=None, **kwargs):
80 def __init__(self, rules=None, **kwargs):
80 if rules is None:
81 if rules is None:
@@ -88,6 +89,8 b' class MathBlockLexer(mistune.BlockLexer):'
88 'text': m.group(1)
89 'text': m.group(1)
89 })
90 })
90
91
92 parse_block_math2 = parse_block_math
93
91 class MathInlineGrammar(mistune.InlineGrammar):
94 class MathInlineGrammar(mistune.InlineGrammar):
92 math = re.compile("^\$(.+?)\$")
95 math = re.compile("^\$(.+?)\$")
93
96
General Comments 0
You need to be logged in to leave comments. Login now