I'm currently running into an issue where I'm experiencing a styling issue due to the actual line break of the output HTML. Essentially, because the Velocity output in the raw HTML of an email includes one to several line breaks, email/web clients will not correctly pick up an anchor within a span as being all together. This behavior does not happen when all content is inline.
"HTML shouldn't render differently depending on line breaks!", you say. I agree, and yet here we are: https://codepen.io/cougrimes/pen/a6b14801a79e2aaab25cc729d09b9504
This behavior occurs in every major email client. Is there any way to force Velocity output to be solely inline?
Well, Velocity is strictly whitespace-preserving. So if there's a line break at the end of a line, Velocity won't ignore it. (This is a very good thing in general because you couldn't output plain text otherwise.)
But if you end a line with a Velocity comment, there is no line break.
Unfortunately, the problem isn't solved by commenting out to prevent a standard return/newline--even when all parts of the code have comments to stop the line, the raw output generated by Marketo is
Si vous avez du mal à afficher le présent courriel, <a href="#" id="std-view-as-webpage" style="text-decoration: none;" class="vib">
cliquez ici pour l'afficher en ligne</a>
As a result, you still get the improper behavior.
Text-only output also renders a space for some reason:
[ cliquez ici pour l'afficher en ligne](#) .
Token placement is just
Tokens themselves are just checking against a defined reference done elsewhere after being converted to strings and trimmed off, then running through a couple #if/#else checks, so you wind up having something a la
#if($lang == "fr")
cliquez ici pour l'afficher en ligne##
View it in your browser##
The same process happens in token1 and token2 (as there are times when there needs to be suffix text and times where simply ending the sentence suffices).