From 59ee9a54754c45fc8db4c260e879f991941dab5f Mon Sep 17 00:00:00 2001 From: Fredrik Blomqvist Date: Fri, 17 Apr 2026 16:17:43 +0200 Subject: [PATCH] Add real break points for newlines in `html` export Fixes #69. --- crates/rustwell/src/export/html.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/crates/rustwell/src/export/html.rs b/crates/rustwell/src/export/html.rs index 851a3b5..6b9e38b 100644 --- a/crates/rustwell/src/export/html.rs +++ b/crates/rustwell/src/export/html.rs @@ -214,15 +214,11 @@ impl HtmlExporter { .map(|e| self.format_rich_element(e)) .collect::>() .concat() + .replace("\n", "
") } /// Formats a [`RichString`] [`rich_string::Element`] into a `html`-[String]. fn format_rich_element(&self, element: &rich_string::Element) -> String { - // Assumes newlines '\n' will only occur sole elements - if element.text == "\n" { - return "
".to_string(); - } - let prepend = format!( "{}{}{}", if element.is_bold() { "" } else { "" },