diff --git a/src/misc/markdown.rs b/src/misc/markdown.rs index d0fe36e..e83848b 100644 --- a/src/misc/markdown.rs +++ b/src/misc/markdown.rs @@ -151,7 +151,7 @@ pub fn get_options<'a>() -> ComrakOptions<'a> { // options.render.broken_link_callback = ...; // Renderer - options.render.hardbreaks = false; // could be true? change by metadata could be good for compatibility + options.render.hardbreaks = true; options.render.github_pre_lang = false; options.render.full_info_string = true; options.render.width = 0; // 0 mean disabled? @@ -286,7 +286,7 @@ pub fn read_md( ) -> File { let arena = Arena::new(); - let opt = options.map_or_else(get_options, |specific_opt| specific_opt); + let mut opt = options.map_or_else(get_options, |specific_opt| specific_opt); let root = parse_document(&arena, raw_text, &opt); // Find metadata @@ -295,6 +295,11 @@ pub fn read_md( let mermaid_name = "mermaid"; hljs_replace(root, mermaid_name); + if let TypeFileMetadata::Blog = metadata_type { + // Change by metadata could be good for compatibility + opt.render.hardbreaks = true; + } + // Convert to HTML let mut html = vec![]; format_html(root, &opt, &mut html).unwrap();