feat: markdown implementation #18

Merged
Anri merged 9 commits from feat/md into main 2023-04-11 01:25:45 +02:00
Showing only changes of commit ff7fa90cdc - Show all commits

View file

@ -60,8 +60,6 @@ pub fn read_md(filename: &str) -> (Metadata, String) {
let compile_option = markdown::CompileOptions { let compile_option = markdown::CompileOptions {
allow_dangerous_html: true, allow_dangerous_html: true,
gfm_footnote_label: Some("Notes de bas de page".into()),
gfm_footnote_back_label: Some("Arrière".into()),
..markdown::CompileOptions::gfm() ..markdown::CompileOptions::gfm()
}; };
@ -85,15 +83,9 @@ pub fn read_md(filename: &str) -> (Metadata, String) {
.unwrap(); .unwrap();
// Find if document contains mermaid diagram // Find if document contains mermaid diagram
let presence_mermaid = md_nodes.iter().fold(false, |acc, x| { let presence_mermaid = md_nodes.iter().any(|x| match x {
if !acc { markdown::mdast::Node::Code(code) => code.lang == Some(String::from("mermaid")),
match x { _ => false,
markdown::mdast::Node::Code(code) => code.lang == Some(String::from("mermaid")),
_ => false,
}
} else {
false
}
}); });
( (