diff --git a/src/runlog.rs b/src/runlog.rs index e1a0d98..e711186 100644 --- a/src/runlog.rs +++ b/src/runlog.rs @@ -150,39 +150,41 @@ impl RunLog { ); doc.push_to_body(ul); - doc.push_to_body(Element::new(Tag::H2).with_text("Request message")); + let mut toc = ToC::default(); + let mut body = Element::new(Tag::Div); + + body.push_child( + toc.push( + Element::new(Tag::Span) + .with_child(Element::new(Tag::Code).with_text("Request message")), + ), + ); let req = serde_json::to_string_pretty(&self.request).unwrap(); let req = Element::new(Tag::Pre).with_text(&req); - doc.push_to_body(req); + body.push_child(req); if let Some(e) = &self.runspec_error { let error = Element::new(Tag::P) .with_text("Failed to load .radicle/native.yaml: ") .with_child(Element::new(Tag::Code).with_text(e)); - doc.push_to_body(error); + body.push_child(error); } if self.timeout { let timeout = Element::new(Tag::P).with_text("Last command timed out"); - doc.push_to_body(timeout); + body.push_child(timeout); } if let Some(runspec) = &self.runspec { let text = serde_yaml::to_string(&runspec).map_err(RunLogError::RunSpec)?; - let native_yaml = Element::new(Tag::Div) - .with_child( - Element::new(Tag::H2) - .with_child(Element::new(Tag::Code).with_text(RUNSPEC_PATH)), - ) - .with_child( - Element::new(Tag::Blockquote) - .with_child(Element::new(Tag::Pre).with_text(&text)), - ); - doc.push_to_body(native_yaml); + body.push_child(toc.push(Element::new(Tag::Span).with_child( + Element::new(Tag::Code).with_child(Element::new(Tag::Code).with_text(RUNSPEC_PATH)), + ))); + body.push_child( + Element::new(Tag::Blockquote).with_child(Element::new(Tag::Pre).with_text(&text)), + ); } - let mut toc = ToC::default(); - let mut body = Element::new(Tag::Div); for cmd in self.commands.iter() { cmd.format(&mut body, &mut toc); }