JSFiddle - React, Tailwind, and code Playground

by Jean-Philippe Janecek

HTML

<link rel="stylesheet" href="http://codemirror.net/lib/codemirror.css">
<script src="http://codemirror.net/lib/codemirror.js"></script>
<body>
    <form>
        <textarea id="code" name="code"></textarea>
    </form>
</body>

CSS

.code  {
    height: 500px,
    width: 100%
}

JavaScript

url = 'http://geo.weather.gc.ca/geomet/?lang=E&service=wms&request=GetCapabilities';

$.getJSON('http://whateverorigin.org/get?url=' + 
          encodeURIComponent(url) + '&callback=?',
          
          function(data) {
              $("#code").html(data.contents);
              console.log(data.contents);
              var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
                  mode: "application/xml",
                  lineNumbers: true
              });
});