");
tasks.push(Task::Close("div".to_owned()));
- } else if !code
- && dom.has_text_boundary(node)
- && !crate::structure::owns_boundaries(tag)
- {
+ } else if !code && dom.has_text_boundary(node) && !owns_boundaries {
output.push(' ');
tasks.push(Task::Literal(" "));
}
diff --git a/moli-html2md/tests/review_semantics.rs b/moli-html2md/tests/review_semantics.rs
index 604a0832ba3..ab6fff1d9b4 100644
--- a/moli-html2md/tests/review_semantics.rs
+++ b/moli-html2md/tests/review_semantics.rs
@@ -1084,6 +1084,40 @@ fn fallback_keeps_code_boxes_and_ignores_column_boxes() {
}
}
+#[test]
+fn stripped_block_elements_keep_their_computed_boundaries_in_tables() {
+ let content =
+ "
";
+ for source in [
+ format!("
{content}
"),
+ format!("
"),
+ format!("
"),
+ ] {
+ let dom = Counted {
+ tree: Tree::parse(&source),
+ visits: Cell::new(0),
+ };
+ let markdown = convert(&dom, dom.tree.root);
+ let output = Tree::parse(&rendered_html(&markdown));
+ let mut text = String::new();
+ for node in &output.nodes {
+ if matches!(node.tag.as_deref(), Some("p" | "div" | "td" | "br")) {
+ text.push(' ');
+ }
+ if let Some(value) = &node.text {
+ text.push_str(value);
+ }
+ }
+ assert!(
+ text.split_whitespace()
+ .collect::
>()
+ .windows(2)
+ .any(|words| words == ["A", "B"]),
+ "{source}: {markdown}\n{text}"
+ );
+ }
+}
+
#[test]
fn content_after_a_nested_list_can_make_the_outer_list_loose() {
assert_eq!(