JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-3.5.0.min.js"></script>
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
<link rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night-blue.css">
<body>
<pre id="pre">
<script type="text/javascript">
// Say hello world until the user starts questioning
// the meaningfulness of their existence.
function helloWorld(world) {
for (var i = 42; --i >= 0;) {
alert('Hello ' + String(world));
}
}
</script>
<style>
p { color: pink }
b { color: blue }
u { color: "umber" }
</style>
</pre>
<button id="button">My button</button>
</body>
JavaScript
$(document).ready(function(){
$("#button").on("click", function(){
$("#pre").addClass("prettyprint").addClass("linenums").addClass("lang-js");
$("#pre").html(PR.prettyPrintOne($("#pre").html()));
});
});