JSFiddle - React, Tailwind, and code Playground
by alanzam2223
HTML
<canvas id="can" width="500" height="500"></canvas>
<div id="tor" style="display:none">
...
JavaScript
var canvas = document.querySelector('#can');
var tor = document.getElementById('tor').innerHTML;
canvas.style.whiteSpace = 'pre';
var ctx= canvas.getContext('2d');
ctx.fillStyle="#ffffff";
ctx.fillRect(0,0,canvas.width,canvas.height);
ctx.fillStyle="#000000";
ctx.textAlign = "left";
ctx.textBaseline = 'top';
ctx.font = '1em monospace';
ctx.fillText(tor,0,0);