Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pweave/formatters/markdownmath.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from xml.etree.ElementTree import Element
import markdown


Expand All @@ -6,7 +7,7 @@ def __init__(self):
markdown.inlinepatterns.Pattern.__init__(self, r'(?<!\\)(\$\$?)(.+?)\2')

def handleMatch(self, m):
node = markdown.util.etree.Element('span class="math"')
node = Element('span class="math"')
# node.text = markdown.util.AtomicString(m.group(2) + m.group(3) + m.group(2))
if m.group(2) == "$$":
node.text = markdown.util.AtomicString("\[" + m.group(3) + "\]")
Expand All @@ -17,5 +18,5 @@ def handleMatch(self, m):

class MathExtension(markdown.Extension):

def extendMarkdown(self, md, md_globals):
md.inlinePatterns.add('math', MathPattern(), '<escape')
def extendMarkdown(self, md):
md.inlinePatterns.register(MathPattern(), 'math', 185)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
markdown
markdown >= 3.0
pygments
ipython
nbformat
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def read(fname):
author_email='matti.pastell@helsinki.fi',
url='http://mpastell.com/pweave',
packages=['pweave', 'pweave.themes', 'pweave.formatters', 'pweave.processors', 'pweave.bokeh'],
install_requires = ['markdown',
install_requires = ['markdown >= 3.0',
'pygments',
'ipython >= 6.0',
'nbformat',
Expand Down