Skip to content

Commit

Permalink
Replace CRLF with LF in content passed to cmark
Browse files Browse the repository at this point in the history
  • Loading branch information
markbahnman committed Dec 11, 2022
1 parent e424803 commit 7a762d5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,9 @@ impl<'p, 'r> PageList<'p, 'r> {

#[inline]
fn render_content<E: Encoder>(source: &str, encoder: &mut E) -> Result<(), E::Error> {
let parser = pulldown_cmark::Parser::new_ext(source, pulldown_cmark::Options::all());
let normalized_source = source.replace("\r\n", "\n");
let parser =
pulldown_cmark::Parser::new_ext(&normalized_source, pulldown_cmark::Options::all());
let processed = cmark_syntax::SyntaxPreprocessor::new(parser);
encoder.write_html(processed)
}
Expand Down

0 comments on commit 7a762d5

Please sign in to comment.