Skip to content

Commit 346740f

Browse files
committed
Removed markdown from dependencies
1 parent 83821bd commit 346740f

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

codext/others/markdown.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,17 @@
66
- encodes strings from bytes to bytes
77
- encodes file content from str to bytes (write)
88
"""
9-
from markdown2 import markdown as md2html
10-
119
from ..__common__ import *
1210

1311

1412
__guess__ = []
1513

1614

17-
def markdown_encode(mdtext, errors="strict"):
18-
return md2html(mdtext), len(mdtext)
19-
20-
21-
# note: the group is NOT captured so that the pattern is only used to match the name of the codec and not to dynamically
22-
# bind to a parametrizable encode function
23-
add("markdown", markdown_encode, pattern=r"^(?:markdown|Markdown|md)$")
15+
try:
16+
from markdown2 import markdown as md2html
17+
# note: the group is NOT captured so that the pattern is only used to match the name of the codec and not to
18+
# dynamically bind to a parametrizable encode function
19+
add("markdown", lambda md, error="strict": (md2html(md), len(md)), pattern=r"^(?:markdown|Markdown|md)$")
20+
except ImportError:
21+
pass
2422

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
markdown2>=2.4.0
21
six

0 commit comments

Comments
 (0)