Here's how on the site in question I can write a comment and sample code, for example:
This is a comment
//это код <script>alert('1');</script> This is another comment.
How correctly this is implemented, so that the comment would be protected from XSS, and the code in the comment is displayed as code! How is such a comment stored in the database, the sample code is extracted and stored separately? or is the comment preserved as a whole? How to display (process when displaying) such a comment?
Can someone write an example, or give a link to some example or a link to the script where this is implemented, I can not find!