Skip to content

Commit

Permalink
Fix first line ending in paragaph after frontmatter
Browse files Browse the repository at this point in the history
Closes GH-143.
  • Loading branch information
wooorm committed Jan 30, 2025
1 parent 4e92bb3 commit e9d53d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/to_html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
6 changes: 6 additions & 0 deletions tests/frontmatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?,
"<p>a\nb</p>",
"should support line endings after frontmatter"
);

assert_eq!(
to_html_with_options("--- a\n---", &frontmatter)?,
"<h2>--- a</h2>",
Expand Down

0 comments on commit e9d53d2

Please sign in to comment.