Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headers are not handled well when combined with details/summary tags #129

Open
alexei-osipov opened this issue May 24, 2024 · 1 comment

Comments

@alexei-osipov
Copy link

h3 results in badly formatted output when combined with details/summary tags

This code

from bs4 import BeautifulSoup
from markdownify import MarkdownConverter

sample = """
<details><summary>Some question text</summary><div><h3>Answer</h3> Answer text</div></details>
"""

soup = BeautifulSoup(sample, 'html.parser')
result = MarkdownConverter().convert_soup(soup)
print(result)

Actual result (on 0.12.1):

Some question text### Answer

 Answer text

Expected result:

Some question text

### Answer

Answer text
@alexei-osipov alexei-osipov changed the title Headers are not handled well when concounter details/summary tags Headers are not handled well when encounter details/summary tags May 24, 2024
@alexei-osipov alexei-osipov changed the title Headers are not handled well when encounter details/summary tags Headers are not handled well when combined with details/summary tags May 24, 2024
@jsm28
Copy link
Contributor

jsm28 commented May 24, 2024

PR #120 should help here, it fixes various cases of block tags not being properly separated from adjacent content, including headers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants