From e9d53d2ac777e1f2575f5c516f9677f3a096c5d8 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 30 Jan 2025 15:14:56 +0100 Subject: [PATCH] Fix first line ending in paragaph after frontmatter Closes GH-143. --- src/to_html.rs | 1 + tests/frontmatter.rs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/to_html.rs b/src/to_html.rs index 6c0a74e..dbb560d 100644 --- a/src/to_html.rs +++ b/src/to_html.rs @@ -743,6 +743,7 @@ fn on_exit_break(context: &mut CompileContext) { /// Handle [`Exit`][Kind::Exit]:[`BlankLineEnding`][Name::BlankLineEnding]. fn on_exit_blank_line_ending(context: &mut CompileContext) { + context.slurp_one_line_ending = false; if context.index == context.events.len() - 1 { context.line_ending_if_needed(); } diff --git a/tests/frontmatter.rs b/tests/frontmatter.rs index a1077f8..5d3b8f5 100644 --- a/tests/frontmatter.rs +++ b/tests/frontmatter.rs @@ -91,6 +91,12 @@ fn frontmatter() -> Result<(), message::Message> { "should support spaces and tabs after closing fence" ); + assert_eq!( + to_html_with_options("---\n---\na\nb", &frontmatter)?, + "

a\nb

", + "should support line endings after frontmatter" + ); + assert_eq!( to_html_with_options("--- a\n---", &frontmatter)?, "

--- a

", -- 2.51.2