From 129c4ef060672499fad38186b0050ab4eceb5db4 Mon Sep 17 00:00:00 2001 From: AlexVonB Date: Sun, 30 May 2021 11:15:20 +0200 Subject: [PATCH 1/2] ignore doctype tag, test cdata tag fixes #45 --- markdownify/__init__.py | 4 ++-- tests/test_advanced.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/markdownify/__init__.py b/markdownify/__init__.py index 9a30b34..0b849fb 100644 --- a/markdownify/__init__.py +++ b/markdownify/__init__.py @@ -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) diff --git a/tests/test_advanced.py b/tests/test_advanced.py index 2435cac..846d8aa 100644 --- a/tests/test_advanced.py +++ b/tests/test_advanced.py @@ -21,3 +21,8 @@ def test_code_with_tricky_content(): assert md('/home/username') == "`/home/`**username**" assert md('First line blah blah
blah blah
second line') \ == "First line `blah blah \nblah blah` second line" + + +def test_special_tags(): + assert md('') == '' + assert md('') == 'foobar' From e96351b666caa3be73592acc5d4aa158ab9d32c4 Mon Sep 17 00:00:00 2001 From: AlexVonB Date: Sun, 30 May 2021 11:20:16 +0200 Subject: [PATCH 2/2] bump to v0.8.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 04dbb80..370bc7f 100644 --- a/setup.py +++ b/setup.py @@ -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', }