ref: 2115409369de78d25a497d135068fb8eee18dc7d
parent: edf1b991bd73bc013c711951ffe23a0d3bd85e3a
author: penny <penny@limitedideas.org>
date: Thu Oct 9 13:04:14 EDT 2025
fix bad link detection
--- a/renderer.go
+++ b/renderer.go
@@ -217,7 +217,7 @@
}
}
}
- if !ismention {+ if !ismention && href != "" {pr.urlmap[index] = append(pr.urlmap[index], href)
refnode := &html.Node{Type: html.TextNode,
--- a/renderer_test.go
+++ b/renderer_test.go
@@ -27,13 +27,13 @@
{"<p>hello<br> world</p>", "hello\r\n\u00a0\u00a0\u00a0world"},// <pre> tests
{"<pre>hello world</pre>", "hello world"},- {"<pre>hello\nworld</pre>", "hello\nworld"}, // TODO: Verify that this is correct+ {"<pre>hello\nworld</pre>", "hello\nworld"}, {"<pre>hello <a href=\"https://example.com\">world</a></pre>", "hello (world) [1]"}, // TODO: Verify that this is correct {"<pre>hello & world</pre>", "hello & world"},// Mentions
{"<p>hello <a href=\"https://example.com\" class=\"mention\">username</a> world</p>", "hello username world"},// a without href
- {"<p>hello <a>world</a></p>", "hello"}, // TODO: this is probably wrong+ {"<p>hello<a>world</a></p>", "hello"},}
for _, param := range parameters { sf := &StatusFormatter{--
⑨