JSFiddle - React, Tailwind, and code Playground

by Mamdouh Freelancer

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<pre>
<h1>aaaa</h1>
<b>Whats up</b>
</pre>

another one

<pre>
<h1>aaaa</h1>
<b>Whats up</b>
</pre>

JavaScript

$("pre").each(function() {
  var h = $(this).html();
  $(this).html(h.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
    return '&#' + i.charCodeAt(0) + ';';
  }));
});