So I have a block of user-supplied text I'm pulling in from a CMS. However, in that string is a simple ' which blows up the whole string and returns an error. I'm trying to locate a solution to keep Vue from tripping up on this and I've hit a wall. Although I have a feeling it's something embarrassingly obvious. Here's the code:
<span v-html="sidebarContent"></span>
<script>
var app = new Vue({
el: '#app',
data: {
// the content below is a representation of what is spit out by a
// server-side rendered variable "@Html.Raw(@Model.Element("BodyCopy").Value)"
sidebarContent: '<p>This is example text of what's being returned.</p>',
},
})
</script>
The offending issue appears to be the "what's" - and specifically the apostrophe ' in the word. The users will often be returning full sentences where these apostrophes will pop up rather frequently, and so the data needs to be able to properly handle those. Any ideas how to accomplish this?
Also the error being returned is: "Uncaught SyntaxError: Unexpected identifier"