Wednesday, August 7, 2013

jQuery thinks C++ include directives are tags

jQuery thinks C++ include directives are tags

I have some code that looks like:
<pre>
<code>
#include <unistd.h>
int main( int argc, char **argv )
{
return 0;
}
</code>
</pre>
And I want to automatically escape it in jQuery like:
$('code').each(function() {
$(this).html($(this).text($(this).html()).html());
console.log($(this).html());
});
The problem is I get a trailing </unistd.h>. How can I resolve this as
painlessly as possible?

No comments:

Post a Comment