Repository: matthewwithanm/python-markdownify

Issue:
Exclude comments
Currently markdownify allows to parse comments, might not very common to see comments (`<!--` & `-->`) in HTML however when you're working with someones HTML code anything can happen.

### Did write a test to check that:
```python
def test_comments():
    text = md("<!-- This is a comment -->")
    assert text == ""
``` 

The test above should pass, however, the response is ` This is a comment ` and it shouldn't be.

### Possible solutions:
- Do not parse at all the comments
- Enable to blacklist or exclude the comments on `strip` parameters or wtv

Awesome work BTW 

Discussion:

Patch:
diff --git a/markdownify/__init__.py b/markdownify/__init__.py
index 6d93e47..5c008d3 100644
--- a/markdownify/__init__.py
+++ b/markdownify/__init__.py
@@ -1,4 +1,4 @@
-from bs4 import BeautifulSoup, NavigableString
+from bs4 import BeautifulSoup, NavigableString, Comment
 import re
 import six
 
@@ -75,7 +75,9 @@ class MarkdownConverter(object):
 
         # Convert the children first
         for el in node.children:
-            if isinstance(el, NavigableString):
+            if isinstance(el, Comment):
+                continue
+            elif isinstance(el, NavigableString):
                 text += self.process_text(six.text_type(el))
             else:
                 text += self.process_tag(el, convert_children_as_inline)


Test patch:
diff --git a/tests/test_advanced.py b/tests/test_advanced.py
index 4c480d7..7ee61d2 100644
--- a/tests/test_advanced.py
+++ b/tests/test_advanced.py
@@ -4,3 +4,13 @@ from markdownify import markdownify as md
 def test_nested():
     text = md('<p>This is an <a href="http://example.com/">example link</a>.</p>')
     assert text == 'This is an [example link](http://example.com/).\n\n'
+
+
+def test_ignore_comments():
+    text = md("<!-- This is a comment -->")
+    assert text == ""
+
+
+def test_ignore_comments_with_other_tags():
+    text = md("<!-- This is a comment --><a href='http://example.com/'>example link</a>")
+    assert text == "[example link](http://example.com/)"