Skip to content

Commit 543dc2a

Browse files
committed
engine_spx2html: close automatic tags when starting certain automatic tags
1 parent 4e81df6 commit 543dc2a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

crates/engine_spx2html/src/emission.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,8 @@ impl EmittingState {
424424
match special {
425425
Special::AutoStartParagraph => {
426426
if self.cur_elstate().do_auto_tags {
427+
self.close_automatics();
428+
427429
// Why are we using <div>s instead of <p>? As the HTML spec
428430
// emphasizes, <p> tags are structural, not semantic. You cannot
429431
// put tags like <ul> or <div> inside <p> -- they automatically
@@ -452,6 +454,7 @@ impl EmittingState {
452454
if let Some(canvas) = self.current_canvas.as_mut() {
453455
canvas.depth += 1;
454456
} else {
457+
self.close_automatics();
455458
self.current_canvas = Some(CanvasState::new(kind, x, y));
456459
}
457460
Ok(())
@@ -474,6 +477,7 @@ impl EmittingState {
474477
}
475478

476479
Special::ManualFlexibleStart(spec) => {
480+
self.close_automatics();
477481
self.handle_flexible_start_tag(x, y, spec, common)
478482
}
479483

0 commit comments

Comments
 (0)