Hi Oliver,
Ok -- you and I have had our serious shared geek moments discussing Java, IIRC, so I didn't really think that tokenization would likely be an issue.
How about this:
If the tokenization is happening in FMP, would it be possible to adapt it, so that, instead of surrounding target tokens with HTML tags, you have the calc engine simply apply the TextColor function to the token?
So, presumably, within the tokenization there would be a line that has (pseudo) code of:
~result = ~result & "<SOME_HTML_TAG>" & ~token & "</SOME_HTML_TAG>" ;
And instead, it could be:
~result = ~result & TextColor( ~token ; RGB( 255 ; 0 ; 0 )) ;
The above would be my approach to get text formatted with color on just the tokens, and to be able to display it that way in a FMP field, or button-bar label.
To go the webviewer approach:
I'd expect to see a class attribute on the HTML tag, something like:
~result = ~result & "<span class='token'>" & ~token & "</span>" ;
And then some corresponding CSS somewhere defined in the output sent to the webviewer:
<style>
.token { color: #ff0000; }
</style>
And, of course, as @Malcolm indicated, the CSS will offer all sorts of ways to make things fancy/beautiful (and not just do a red text color as in the example above).
When it comes time to set all the content into the webviewer, I would include the basic parts to form an HTML page:
<!DOCTYPE html>
<html>
<head>
<style>
.token { color: #ff0000; }
</style>
</head>
<body>
blah blah blah <span class='token'>DIFF lines: 20<span> blah blah blah
blah blah blah <span class='token'>DIFF lines: 20<span> blah blah blah
</body>
</html>
The only other point I should mention is that, as HTML, your text will suddenly lose things like line breaks that would normally display within FMP text in a field. That would have to be accounted for, but should not be too difficult.