Compare commits
2 commits
a7aec1b94e
...
91dc938fb1
Author | SHA1 | Date | |
---|---|---|---|
91dc938fb1 | |||
fb44c25e47 |
1 changed files with 18 additions and 2 deletions
|
@ -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;
|
||||||
|
@ -178,7 +178,7 @@ fn custom_img_size(html: &str) -> String {
|
||||||
RewriteStrSettings {
|
RewriteStrSettings {
|
||||||
element_content_handlers: vec![element!("img[alt]", |el| {
|
element_content_handlers: vec![element!("img[alt]", |el| {
|
||||||
let alt = el.get_attribute("alt").unwrap();
|
let alt = el.get_attribute("alt").unwrap();
|
||||||
let possible_piece = alt.split(|c| c == '|').collect::<Vec<&str>>();
|
let possible_piece = alt.split('|').collect::<Vec<&str>>();
|
||||||
|
|
||||||
if possible_piece.len() > 1 {
|
if possible_piece.len() > 1 {
|
||||||
let data = possible_piece.last().unwrap().trim();
|
let data = possible_piece.last().unwrap().trim();
|
||||||
|
@ -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));
|
||||||
|
|
Loading…
Reference in a new issue