JSFiddle - React, Tailwind, and code Playground

by Emily Humphrey

HTML

<textarea id="gps" oninput="this.editor.update()" rows="6" cols="60">
#magic
##magic
###magic
</textarea>
<button>get</button>
<div id="preview"> </div>

CSS

.black{
    background:#333;
}

JavaScript

var gps = $('#gps').text();

$('button').click(function(){
    var arrayOfLines = $('#gps').val().split('\n');
    $.each(arrayOfLines, function(index, item) {
        if(item.match("^###")) {
           console.log(item + "header 3");
        } else if(item.match("^##")){
           console.log(item + "header 2");
        } else if(item.match("^#")){
           console.log(item + "header 1");
        }
    });
});