Skip to content

Commit 8c9b029

Browse files
committed
Merge branch 'develop'
2 parents ae50065 + 25d68b4 commit 8c9b029

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

README.rst

+18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
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+
119
Installation
220
============
321

markdownify/__init__.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
convert_heading_re = re.compile(r'convert_h(\d+)')
77
line_beginning_re = re.compile(r'^', re.MULTILINE)
88
whitespace_re = re.compile(r'[\r\n\s\t ]+')
9-
FRAGMENT_ID = '__MARKDOWNIFY_WRAPPER__'
10-
wrapped = '<div id="%s">%%s</div>' % FRAGMENT_ID
119

1210

1311
# Heading styles
@@ -62,12 +60,8 @@ def __init__(self, **options):
6260
' convert, but not both.')
6361

6462
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
6963
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)
7165

7266
def process_tag(self, node, children_only=False):
7367
text = ''

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
pkgmeta = {
1111
'__title__': 'markdownify',
1212
'__author__': 'Matthew Tretter',
13-
'__version__': '0.5.2',
13+
'__version__': '0.5.3',
1414
}
1515

1616

tests/test_conversions.py

+4
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,7 @@ def test_bullets():
157157
def test_img():
158158
assert md('<img src="/path/to/img.jpg" alt="Alt text" title="Optional title" />') == '![Alt text](/path/to/img.jpg "Optional title")'
159159
assert md('<img src="/path/to/img.jpg" alt="Alt text" />') == '![Alt text](/path/to/img.jpg)'
160+
161+
162+
def test_div():
163+
assert md('Hello</div> World') == 'Hello World'

0 commit comments

Comments
 (0)