make html more correct

This commit is contained in:
Crispy 2024-11-03 22:40:32 +01:00
parent eafbc710ff
commit fbb4475c92

View file

@ -47,7 +47,7 @@ pub fn convert_document(markdown: &str) -> String {
let mut attributes = img_info.split(':'); let mut attributes = img_info.split(':');
let src = attributes.next().unwrap(); let src = attributes.next().unwrap();
let alt = attributes.next().unwrap_or_else(|| &"\"\""); let alt = attributes.next().unwrap_or_else(|| &"\"\"");
html += &format!("<img loading=\"lazy\" src={src} alt={alt} title={alt}></img>\n"); html += &format!("<img loading=\"lazy\" src={src} alt={alt} title={alt}>\n");
continue; continue;
} }
@ -61,7 +61,7 @@ pub fn convert_document(markdown: &str) -> String {
} }
if let Some(youtube_id) = line.strip_prefix("==youtube:") { if let Some(youtube_id) = line.strip_prefix("==youtube:") {
html += &format!("<a href=\"https://youtu.be/{youtube_id}\">https://youtu.be/{youtube_id}</a>\n<iframe loading=\"lazy\" src=\"https://www.youtube-nocookie.com/embed/{youtube_id}\" width=\"600px\" height=\"340px\" allowfullscreen></iframe>"); html += &format!("<a href=\"https://youtu.be/{youtube_id}\">https://youtu.be/{youtube_id}</a><br>\n<iframe loading=\"lazy\" src=\"https://www.youtube-nocookie.com/embed/{youtube_id}\" width=\"600px\" height=\"340px\" allowfullscreen></iframe>");
continue; continue;
} }