Compare commits

..

3 Commits
0.8.0 ... 0.8.1

Author SHA1 Message Date
AlexVonB
917b01e548 Merge branch 'develop' 2021-05-30 11:20:32 +02:00
AlexVonB
e96351b666 bump to v0.8.1 2021-05-30 11:20:16 +02:00
AlexVonB
129c4ef060 ignore doctype tag, test cdata tag
fixes #45
2021-05-30 11:18:18 +02:00
3 changed files with 8 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
from bs4 import BeautifulSoup, NavigableString, Comment
from bs4 import BeautifulSoup, NavigableString, Comment, Doctype
import re
import six
@@ -124,7 +124,7 @@ class MarkdownConverter(object):
# Convert the children first
for el in node.children:
if isinstance(el, Comment):
if isinstance(el, Comment) or isinstance(el, Doctype):
continue
elif isinstance(el, NavigableString):
text += self.process_text(el)

View File

@@ -10,7 +10,7 @@ read = lambda filepath: codecs.open(filepath, 'r', 'utf-8').read()
pkgmeta = {
'__title__': 'markdownify',
'__author__': 'Matthew Tretter',
'__version__': '0.8.0',
'__version__': '0.8.1',
}

View File

@@ -21,3 +21,8 @@ def test_code_with_tricky_content():
assert md('<code>/home/</code><b>username</b>') == "`/home/`**username**"
assert md('First line <code>blah blah<br />blah blah</code> second line') \
== "First line `blah blah \nblah blah` second line"
def test_special_tags():
assert md('<!DOCTYPE html>') == ''
assert md('<![CDATA[foobar]]>') == 'foobar'