From 7ff4ba438acb1e01adb0e24137ef992f30d4404d Mon Sep 17 00:00:00 2001
From: Trask Stalnaker
*
* ", indent)?;
}
@@ -270,8 +277,9 @@ impl<'source> HtmlRenderer<'source> {
if options.old_style_paragraph {
ctx.add_old_style_paragraph = true;
} else {
- ctx.push_unbroken_ln("
* [!NOTE] Something very important here
diff --git a/crates/weaver_forge/expected_output/comment_format/example.java b/crates/weaver_forge/expected_output/comment_format/example.java
index c657c358..951bec7d 100644
--- a/crates/weaver_forge/expected_output/comment_format/example.java
+++ b/crates/weaver_forge/expected_output/comment_format/example.java
@@ -109,7 +109,6 @@
* It can contain multiple lines.
* Lorem ipsum dolor sit amet, consectetur adipiscing
* elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- *
*
* [!NOTE] Something very important here
diff --git a/crates/weaver_forge/src/formats/html.rs b/crates/weaver_forge/src/formats/html.rs
index 59c427bf..cfc6abf7 100644
--- a/crates/weaver_forge/src/formats/html.rs
+++ b/crates/weaver_forge/src/formats/html.rs
@@ -65,6 +65,9 @@ struct RenderContext {
// The rendered HTML.
html: String,
+ // Add a newline before rendering the next tag.
+ add_newline: bool,
+
// The rendering process traverses the AST tree in a depth-first manner.
// In certain circumstances, a tag should only be rendered if there is a
// node following the current one in the AST traversal. This field contains
@@ -80,6 +83,7 @@ impl RenderContext {
fn new(cfg: &WordWrapConfig) -> Self {
Self {
html: Default::default(),
+ add_newline: Default::default(),
add_old_style_paragraph: Default::default(),
word_wrap: WordWrapContext::new(cfg),
}
@@ -243,8 +247,11 @@ impl<'source> HtmlRenderer<'source> {
format: &str,
options: &HtmlRenderOptions,
) -> Result<(), Error> {
- if ctx.add_old_style_paragraph {
+ if ctx.add_newline {
ctx.pushln(indent)?;
+ ctx.add_newline = false;
+ }
+ if ctx.add_old_style_paragraph {
if !matches!(md_node, Node::List(_)) {
ctx.push_unbroken_ln("