Presumably because when you are inserting it into the DOM, you are inserting it as text and not as HTML.
Since you haven't show the code you are using to do that, it is hard to say for sure, or to say what the best way to change it so it expects HTML would be.