Skip to content

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

Closed as not planned
@alexei-osipov

Description

@alexei-osipov

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions