diff --git a/src/html.rs b/src/html.rs index d06cfe8..d1d0350 100644 --- a/src/html.rs +++ b/src/html.rs @@ -74,9 +74,16 @@ impl Traverser for Handler { }; if link.is_image() { - // FIXME: needs alt text support - self.0 - .push_str(format!("", HtmlEscape(&path))); + if let Some(Some(caption)) = link.caption().map(|c| c.value()) { + self.0.push_str(format!( + r#"{}"#, + HtmlEscape(&path), + HtmlEscape(caption.trim()) + )); + } else { + self.0 + .push_str(format!("", HtmlEscape(&path))); + } return ctx.skip(); }