You have some arbitrary data in c.my_string and therefore do not want to use "| n", right?
The fastest way to avoid this in JS-style shielding would be
var a = ${c.my_string.__repr__()|n};
However, I'm not sure about the characters <>(with the addition of something like </script>), you might also want to use.replace('<', '<');
For Unicode, you also need to remove the "u" character from the beginning of the line.
source
share