@@ -171,6 +171,8 @@ impl Markdown {
171171 Event::Start(Tag::List(list)) => list_stack.push(list),
172172 Event::End(Tag::List(_)) => {
173173 list_stack.pop();
174+ // whenever list closes, new line
175+ lines.push(Spans::default());
174176 }
175177 Event::Start(Tag::Item) => {
176178 tags.push(Tag::Item);
@@ -186,11 +188,19 @@ impl Markdown {
186188 | Tag::Paragraph
187189 | Tag::CodeBlock(CodeBlockKind::Fenced(_))
188190 | Tag::Item => {
189− // whenever code block or paragraph closes, new line
190191 let spans = std::mem::take(&mut spans);
191192 if !spans.is_empty() {
192193 lines.push(Spans::from(spans));
193194 }
195+ }
196+ _ => (),
197+ }
198+
199+ // whenever heading, code block or paragraph closes, new line
200+ match tag {
201+ Tag::Heading(_, _, _)
202+ | Tag::Paragraph
203+ | Tag::CodeBlock(CodeBlockKind::Fenced(_)) => {
194204 lines.push(Spans::default());
195205 }
196206 _ => (),