default to hardbreak minus blog

This commit is contained in:
Mylloon 2024-11-06 16:11:42 +01:00
parent 3e5ac643a7
commit b02f715c5a
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -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();