JSFiddle - React, Tailwind, and code Playground

by Marc Brooks

HTML

<script src="https://rawgit.com/tsayen/dom-to-image/master/src/dom-to-image.js"></script>
<div id="dom-node">
  ISSUE_TEMPLATE
</div>

<div id="result">
</div>

CSS

#dom-node {
  height: 100px;
  width: 200px;
  background-color: lightgrey;
  text-align: center;
  padding: 1em;
}

#result {
  margin-top: 10px;
}

JavaScript

domtoimage.toSvg(document.getElementById('dom-node'))
  .then(function(dataUrl) {
    var img = new Image();
    document.getElementById('result').appendChild(img);
    img.src = dataUrl;
  })
  .catch(function(e) {
    console.log(e);
  })