diff --git a/mdhtml/src/lib.rs b/mdhtml/src/lib.rs
index 485d238..503b34f 100644
--- a/mdhtml/src/lib.rs
+++ b/mdhtml/src/lib.rs
@@ -29,31 +29,32 @@ impl TokenSink for Sink {
self.0.push_str(tag.name.as_ref());
- match tag.name.as_ref() {
- "img" => for attr in tag.attrs {
- match attr.name.local.as_ref() {
- "src" => self.0.push_str(&format!(" src=\"{}\"", attr.value.as_ref())),
- "title" => self.0.push_str(&format!(" title=\"{}\"", attr.value.as_ref())),
- "alt" => self.0.push_str(&format!(" alt=\"{}\"", attr.value.as_ref())),
- _ => {},
- }
- },
- "a" => {
- for attr in tag.attrs {
- match attr.name.local.as_ref() {
- "href" => self.0.push_str(&format!(" href=\"{}\"", attr.value.as_ref())),
- "title" => self.0.push_str(&format!(" title=\"{}\"", attr.value.as_ref())),
- _ => {},
- }
- }
- self.0.push_str(" rel=\"nofollow noreferrer\" target=\"_blank\"");
- },
- _ => {},
- }
-
if tag.self_closing {
self.0.push('/');
+ } else {
+ match tag.name.as_ref() {
+ "img" => for attr in tag.attrs {
+ match attr.name.local.as_ref() {
+ "src" => self.0.push_str(&format!(" src=\"{}\"", attr.value.as_ref())),
+ "title" => self.0.push_str(&format!(" title=\"{}\"", attr.value.as_ref())),
+ "alt" => self.0.push_str(&format!(" alt=\"{}\"", attr.value.as_ref())),
+ _ => {},
+ }
+ },
+ "a" => {
+ for attr in tag.attrs {
+ match attr.name.local.as_ref() {
+ "href" => self.0.push_str(&format!(" href=\"{}\"", attr.value.as_ref())),
+ "title" => self.0.push_str(&format!(" title=\"{}\"", attr.value.as_ref())),
+ _ => {},
+ }
+ }
+ self.0.push_str(" rel=\"nofollow noreferrer\" target=\"_blank\"");
+ },
+ _ => {},
+ }
}
+
self.0.push('>');
},
Token::CharacterTokens(txt) => self.0.push_str(txt.as_ref()),