phoneboy
6 years agoDirector
How do I retrieve an excerpt of a message with HTML formatting?
We want to retrieve an excerpt of a topic message from a given thread and display it in a custom component.
Currently, we're using something like the following to do it:
<#assign body = (page.context.thread.topicMessage.body)!"" />
<div class="short-message"><@messageBodySimple body, 1500 /></div>
In this example, it pulls out the first 1500 characters.
Unfortunately, it strips all the formatting out of the text, which means it does not display very nice.
Is there a way to do this that preserves the HTML formatting?