From da78b8aaff657cb3d89b5968b5bad7fb964b7d21 Mon Sep 17 00:00:00 2001 From: demo Date: Sat, 9 May 2026 12:00:26 -0400 Subject: feat: assume HTML preserves spacing as intended --- internal/findlinks/findlinks_v2.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'internal/findlinks/findlinks_v2.go') 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 GitHub!") 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() -- cgit v1.2.3