Compare commits

...

1 commit

Author SHA1 Message Date
91dc938fb1
french quotes 2024-09-14 20:32:26 +02:00

View file

@ -146,7 +146,7 @@ pub fn get_options<'a>() -> ComrakOptions<'a> {
options.extension.greentext = false; options.extension.greentext = false;
// Parser // Parser
options.parse.smart = true; // could be boring options.parse.smart = false; // could be boring
options.parse.default_info_string = Some("plaintext".into()); options.parse.default_info_string = Some("plaintext".into());
options.parse.relaxed_tasklist_matching = true; options.parse.relaxed_tasklist_matching = true;
options.parse.relaxed_autolinks = true; options.parse.relaxed_autolinks = true;
@ -289,6 +289,8 @@ pub fn read_md(
let mermaid_name = "mermaid"; let mermaid_name = "mermaid";
hljs_replace(root, mermaid_name); hljs_replace(root, mermaid_name);
replace_quotes(root);
// Convert to HTML // Convert to HTML
let mut html = vec![]; let mut html = vec![];
format_html(root, &opt, &mut html).unwrap(); format_html(root, &opt, &mut html).unwrap();
@ -434,6 +436,20 @@ fn hljs_replace<'a>(root: &'a AstNode<'a>, mermaid_str: &str) {
}); });
} }
/// TODO
fn replace_quotes<'a>(node: &'a AstNode<'a>) {
match &mut node.data.borrow_mut().value {
NodeValue::Text(text) => {
*text = text.replacen('"', "«", 1).replacen('"', "»", 1);
}
_ => {
for c in node.children() {
replace_quotes(c);
}
}
}
}
/// Obfuscate email if email found /// Obfuscate email if email found
fn mail_obfuscation(html: &str) -> (String, bool) { fn mail_obfuscation(html: &str) -> (String, bool) {
let modified = Arc::new(AtomicBool::new(false)); let modified = Arc::new(AtomicBool::new(false));