-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support ~~strikethrough~~ and ++underscores++
- Loading branch information
1 parent
f722347
commit 5a4cacc
Showing
7 changed files
with
72 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
__VERSION__ = '1.1.4' | ||
__VERSION__ = '1.1.5' | ||
__AUTHOR__ = 'Agus Makmun (Summon Agus)' | ||
__AUTHOR_EMAIL__ = 'agus@python.web.id' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#! /usr/bin/env python | ||
|
||
|
||
''' | ||
Del/Ins Extension for Python-Markdown | ||
===================================== | ||
Wraps the inline content with ins/del tags. | ||
Usage | ||
----- | ||
>>> import markdown | ||
>>> src = """This is ++added content++ and this is ~~deleted content~~""" | ||
>>> html = markdown.markdown(src, ['del_ins']) | ||
>>> print(html) | ||
<p>This is <ins>added content</ins> and this is <del>deleted content</del> | ||
</p> | ||
Dependencies | ||
------------ | ||
* [Markdown 2.0+](http://www.freewisdom.org/projects/python-markdown/) | ||
Copyright | ||
--------- | ||
2011, 2012 [The active archives contributors](http://activearchives.org/) | ||
All rights reserved. | ||
This software is released under the modified BSD License. | ||
See LICENSE.md for details. | ||
''' | ||
|
||
|
||
import markdown | ||
from markdown.inlinepatterns import SimpleTagPattern | ||
|
||
|
||
DEL_RE = r"(\~\~)(.+?)(\~\~)" | ||
INS_RE = r"(\+\+)(.+?)(\+\+)" | ||
|
||
|
||
class DelInsExtension(markdown.extensions.Extension): | ||
"""Adds del_ins extension to Markdown class.""" | ||
|
||
def extendMarkdown(self, md, md_globals): | ||
"""Modifies inline patterns.""" | ||
md.inlinePatterns.add('del', SimpleTagPattern(DEL_RE, 'del'), '<not_strong') | ||
md.inlinePatterns.add('ins', SimpleTagPattern(INS_RE, 'ins'), '<not_strong') | ||
|
||
|
||
def makeExtension(configs={}): | ||
return DelInsExtension(configs=dict(configs)) | ||
|
||
|
||
if __name__ == "__main__": | ||
import doctest | ||
doctest.testmod() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters