cleanup up emoji in hoots
Ted Unangst tedu@tedunangst.com
Sun, 19 Feb 2023 19:39:13 -0500
1 files changed,
3 insertions(+),
2 deletions(-)
jump to
M
hoot.go
→
hoot.go
@@ -55,10 +55,11 @@
var htf htfilter.Filter htf.Imager = func(node *html.Node) string { alt := htfilter.GetAttr(node, "alt") - if htfilter.HasClass(node, "Emoji") && alt != "" { + src := htfilter.GetAttr(node, "src") + if htfilter.HasClass(node, "Emoji") || strings.HasSuffix(src, ".svg") { return alt } - return string(templates.Sprintf(" <img src='%s' alt='%s'>", htfilter.GetAttr(node, "src"), alt)) + return string(templates.Sprintf(" <img src='%s' alt='%s'>", src, alt)) } var buf strings.Builder