Show more-less button showing formatting characters

I have gotten the show more-less button code working for text in a repeater on a page filled from a dataset. Unfortunately, it is showing the formatting code for every space, paragraph, font, etc as well as the actual content. I have tried changing the column from rich text to plain text. Same problem. I know it’s the button code, because the content fills just fine on another page with a repeater also filled from a rich text column in another dataset. How do I instruct it to select the actual content characters and not the formatting?