fix: image floats, link color metadata

This commit is contained in:
trisua 2025-07-25 18:06:29 -04:00
parent dbd70d9592
commit 06b0aa0b4c
9 changed files with 43 additions and 14 deletions

View file

@ -3,7 +3,7 @@ use std::collections::HashSet;
pub fn render_markdown(input: &str) -> String {
let html = tetratto_shared::markdown::render_markdown_dirty(&parse_text_color(
&parse_highlight(&parse_link(&parse_image(&parse_image_size(
&parse_underline(&parse_comment(input)),
&parse_underline(&parse_comment(&input.replace("[/]", "<br />"))),
)))),
));
@ -359,7 +359,7 @@ fn parse_image_size_line(output: &mut String, buffer: &mut String, line: &str) {
if in_size && in_size_rhs {
// end
output.push_str(&format!(
"<span style=\"width: {}; height: {}\" class=\"img_sizer\">![{buffer}</span>",
"<span style=\"width: {}; height: {}; float: {}\" class=\"img_sizer\">![{buffer}</span>",
if is_numeric(&size_lhs) {
format!("{size_lhs}px")
} else {
@ -369,6 +369,13 @@ fn parse_image_size_line(output: &mut String, buffer: &mut String, line: &str) {
format!("{size_rhs}px")
} else {
size_rhs
},
if buffer.ends_with("#left)") {
"left"
} else if buffer.ends_with("#right)") {
"right"
} else {
"unset"
}
));