Do you mean you want the literal, for example, <b>Hello</b>
instead of Hello
?
If so, just do a quick:
myHTML = myHTML.replace(/[<>&
]/g, function(x) {
return {
'<': '<',
'>': '>',
'&': '&',
'
': '<br />'
}[x];
});
Before outputting it. You can apply this to many other characters, say for instance if you wanted to output whitespace literally.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…