diff core/mdexts/deleted.py @ 848:32ebe22f0cad

For issue #79 update to Markdown 2.5.1. This commit follows new Markdown conventions for extensions.
author Brian Neal <bgneal@gmail.com>
date Tue, 28 Oct 2014 19:33:14 -0500
parents tools/mdx_del.py@2e90b63520b8
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/mdexts/deleted.py	Tue Oct 28 19:33:14 2014 -0500
@@ -0,0 +1,19 @@
+"""
+A python-markdown extension to add support for <del>.
+The Markdown syntax is --this is deleted text--.
+
+"""
+import markdown
+
+
+DEL_RE = r'(---)(.*?)---'
+
+class DelExtension(markdown.Extension):
+
+    def extendMarkdown(self, md, md_globals):
+        del_tag = markdown.inlinepatterns.SimpleTagPattern(DEL_RE, 'del')
+        md.inlinePatterns.add('del', del_tag, '>not_strong')
+
+
+def makeExtension(configs=None):
+    return DelExtension(configs)