Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/html_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ class HtmlParser extends StatelessWidget {
}

//Return the correct InlineSpan based on the element type.
if (tree.style.display == Display.BLOCK && tree.children.isNotEmpty) {
if (tree.style.display == Display.BLOCK &&
(tree.children.isNotEmpty || tree.element?.localName == "hr")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: I don't think there are any other tags that render as block yet have no children. cf https://developer.mozilla.org/en-US/docs/Glossary/Empty_element

if (newContext.parser.selectable) {
return TextSpan(
style: newContext.style.generateTextStyle(),
Expand Down
3 changes: 2 additions & 1 deletion lib/src/styled_element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ StyledElement parseStyledElement(
styledElement.style = Style(
margin: EdgeInsets.symmetric(vertical: 7.0),
width: double.infinity,
border: Border(bottom: BorderSide(width: 1.0)),
height: 1,
backgroundColor: Colors.black,
display: Display.BLOCK,
);
break;
Expand Down