File tree 4 files changed +24
-8
lines changed
4 files changed +24
-8
lines changed Original file line number Diff line number Diff line change
1
+ |build | |version | |license | |downloads |
2
+
3
+ .. |build | image :: https://img.shields.io/github/workflow/status/matthewwithanm/python-markdownify/Python%20application/develop
4
+ :alt: GitHub Workflow Status
5
+ :target: https://github.com/matthewwithanm/python-markdownify/actions?query=workflow%3A%22Python+application%22
6
+
7
+ .. |version | image :: https://img.shields.io/pypi/v/markdownify
8
+ :alt: Pypi version
9
+ :target: https://pypi.org/project/markdownify/
10
+
11
+ .. |license | image :: https://img.shields.io/pypi/l/markdownify
12
+ :alt: License
13
+ :target: https://github.com/matthewwithanm/python-markdownify/blob/develop/LICENSE
14
+
15
+ .. |downloads | image :: https://pepy.tech/badge/markdownify
16
+ :alt: Pypi Downloads
17
+ :target: https://pepy.tech/project/markdownify
18
+
1
19
Installation
2
20
============
3
21
Original file line number Diff line number Diff line change 6
6
convert_heading_re = re .compile (r'convert_h(\d+)' )
7
7
line_beginning_re = re .compile (r'^' , re .MULTILINE )
8
8
whitespace_re = re .compile (r'[\r\n\s\t ]+' )
9
- FRAGMENT_ID = '__MARKDOWNIFY_WRAPPER__'
10
- wrapped = '<div id="%s">%%s</div>' % FRAGMENT_ID
11
9
12
10
13
11
# Heading styles
@@ -62,12 +60,8 @@ def __init__(self, **options):
62
60
' convert, but not both.' )
63
61
64
62
def convert (self , html ):
65
- # We want to take advantage of the html5 parsing, but we don't actually
66
- # want a full document. Therefore, we'll mark our fragment with an id,
67
- # create the document, and extract the element with the id.
68
- html = wrapped % html
69
63
soup = BeautifulSoup (html , 'html.parser' )
70
- return self .process_tag (soup . find ( id = FRAGMENT_ID ) , children_only = True )
64
+ return self .process_tag (soup , children_only = True )
71
65
72
66
def process_tag (self , node , children_only = False ):
73
67
text = ''
Original file line number Diff line number Diff line change 10
10
pkgmeta = {
11
11
'__title__' : 'markdownify' ,
12
12
'__author__' : 'Matthew Tretter' ,
13
- '__version__' : '0.5.2 ' ,
13
+ '__version__' : '0.5.3 ' ,
14
14
}
15
15
16
16
Original file line number Diff line number Diff line change @@ -157,3 +157,7 @@ def test_bullets():
157
157
def test_img ():
158
158
assert md ('<img src="/path/to/img.jpg" alt="Alt text" title="Optional title" />' ) == ''
159
159
assert md ('<img src="/path/to/img.jpg" alt="Alt text" />' ) == ''
160
+
161
+
162
+ def test_div ():
163
+ assert md ('Hello</div> World' ) == 'Hello World'
You can’t perform that action at this time.
0 commit comments