Skip to content

Commit 91a5f32

Browse files
committed
feat: define MarkdownConverter#convert_soup
1 parent dbff386 commit 91a5f32

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

markdownify/__init__.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,5 @@ class MarkdownConverter:
7171

7272
def convert(self, html: str) -> str:
7373
...
74+
def convert_soup(self, soup: Incomplete) -> str:
75+
...

tests/types.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from markdownify import markdownify, ASTERISK, BACKSLASH, LSTRIP, RSTRIP, SPACES, STRIP, UNDERLINED, UNDERSCORE, MarkdownConverter
2+
from bs4 import BeautifulSoup
23

34
markdownify("<p>Hello</p>") == "Hello" # test default of STRIP
45
markdownify("<p>Hello</p>", strip_document=LSTRIP) == "Hello\n\n"
@@ -51,3 +52,7 @@
5152
code_language='python',
5253
code_language_callback=None
5354
).convert("")
55+
56+
html = '<b>test</b>'
57+
soup = BeautifulSoup(html, 'html.parser')
58+
MarkdownConverter().convert_soup(soup) == '**test**'

0 commit comments

Comments
 (0)