summaryrefslogtreecommitdiff
path: root/internal/findlinks
diff options
context:
space:
mode:
Diffstat (limited to 'internal/findlinks')
-rw-r--r--internal/findlinks/findlinks_v2.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/internal/findlinks/findlinks_v2.go b/internal/findlinks/findlinks_v2.go
index e56a961..e55dc90 100644
--- a/internal/findlinks/findlinks_v2.go
+++ b/internal/findlinks/findlinks_v2.go
@@ -62,11 +62,14 @@ func harvestText(n *html.Node) string {
return n.Data
// The text of an [html.ElementNode] is the aggregate of the
- // text of its children.
+ // text of its children. We can assume that text is otherwise
+ // correctly formatted in terms of spacing (i.e. markup
+ // doesn't otherwise introduce run-on words unless intended,
+ // for example "I am on <strong>GitHub</strong>!")
case html.ElementNode:
var builder strings.Builder
- for c := n.FirstChild; c != nil; c = c.NextSibling {
- fmt.Fprintf(&builder, "%s ", harvestText(c))
+ for child := n.FirstChild; child != nil; child = child.NextSibling {
+ builder.WriteString(harvestText(child))
}
rawResult := builder.String()