feat: markdown implementation
#18
1 changed files with 3 additions and 11 deletions
|
@ -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 {
|
|
||||||
match x {
|
|
||||||
markdown::mdast::Node::Code(code) => code.lang == Some(String::from("mermaid")),
|
markdown::mdast::Node::Code(code) => code.lang == Some(String::from("mermaid")),
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
(
|
(
|
||||||
|
|
Loading…
Reference in a new issue