Kirbytext link widont error

I discovered will broken link testing that under my conditions, the widont helper was ruining links that existed at the end of a text field.

It was inserting non breaking spaces inside the rendered html of the anchor tag.

<?= $page->text()->kt()->smartypants()->widont() ?>

Panel text at the end of the text field:

…more text here…
(link: http://worldrecords.me/pictures.html text: worldrecords.me)

Rendered code breaks the anchor text:

<a&nbsp;href="http: worldrecords.me="" pictures.html"="">worldrecords.me</a&nbsp;href="http:>

I believe the widont helper is inserting the non breaking spaces in the last element, but there are times when the widont helper is helpful. When I remove the widont helper, everything works fine.

Thoughts?

It’s probably not a good idea to call it after kt() but before.

Okay, tried that. Now it inserts the nbsp; into the text, but at least the link itself is correct.